Basic Linux commands

16
www.atozknowledge.com

Transcript of Basic Linux commands

Page 1: Basic Linux commands

www.atozknowledge.com

Page 2: Basic Linux commands

File Handling Text Processing System Administration Process Management Archival Network File Systems Advanced Commands

www.atozknowledge.com

Page 3: Basic Linux commands

mkdir – make directoriesUsage: mkdir [OPTION] DIRECTORY...eg. mkdir hadoop

ls – list directory contentsUsage: ls [OPTION]... [FILE]...eg. ls, ls l, ls hadoop

cd – changes directoriesUsage: cd [DIRECTORY]eg. cd prabhat

www.atozknowledge.com

Page 4: Basic Linux commands

pwd – print name of current working directoryUsage: pwd

vim – Vi Improved, a programmers text editorUsage: vim [OPTION] [file]...eg. vim file1.txt

www.atozknowledge.com

Page 5: Basic Linux commands

cp – copy files and directoriesUsage: cp [OPTION]... SOURCEDEST eg. cp sample.txt sample_copy.txtcp sample_copy.txt target_dir mv – move (rename) filesUsage: mv [OPTION]... SOURCEDESTeg. mv source.txt target_dir mv old.txt new.txt

www.atozknowledge.com

Page 6: Basic Linux commands

rm – remove files or directoriesUsage: rm [OPTION]... FILE...eg. rm file1.txt , rm rf some_dir

history – prints recently used commands

www.atozknowledge.com

Page 7: Basic Linux commands

cat – concatenate files and print on the standard outputUsage: cat [OPTION] [FILE]...eg. cat file1.txt file2.txt

echo – display a line of textUsage: echo [OPTION] [string] ...eg. echo I love Indiaecho $HOME

www.atozknowledge.com

Page 8: Basic Linux commands

grep – print lines matching a patternUsage: grep [OPTION] PATTERN [FILE]...eg. grep -i apple sample.txt

wc - print the number of newlines, words, and bytes in filesUsage: wc [OPTION]... [FILE]...eg. wc file1.txt

sort – sort lines of text filesUsage: sort [OPTION]... [FILE]...eg. sort file1.txtsort – r file1.txt

www.atozknowledge.com

Page 9: Basic Linux commands

chmod – change file accesspermissionsUsage: chmod [OPTION] [MODE] [FILE]eg. chmod 744 calculate.sh

chown – change file owner and groupUsage: chown [OPTION]... OWNER[:[GROUP]]FILE...eg. chown remo myfile.txt

www.atozknowledge.com

Page 10: Basic Linux commands

Numeric Permissions:CHMOD can also to attributed by using Numeric Permissions:

400 read by owner040 read by group004 read by anybody (other)200 write by owner020 write by group002 write by anybody100 execute by owner010 execute by group001 execute by anybody

www.atozknowledge.com

Page 11: Basic Linux commands

su – change user ID or become superuserUsage: su [OPTION] [LOGIN]eg. su remo, su

passwd – update a user’s authentication tokens(s)Usage: passwd [OPTION]eg. Passwd

who – show who is logged onUsage: who [OPTION]eg. who , who -b, who -q

www.atozknowledge.com

Page 12: Basic Linux commands

ps – report a snapshot of the currentprocessesUsage: ps [OPTION]eg. ps

kill – to kill a process(using signal mechanism)Usage: kill [OPTION] pideg. Kill -9 2275

www.atozknowledge.com

Page 13: Basic Linux commands

du – estimate file space usageUsage: du [OPTION]... [FILE]...eg. du df – report filesystem disk space usageUsage: df [OPTION]... [FILE]...eg. df

www.atozknowledge.com

Page 14: Basic Linux commands

tar – to archive a fileUsage: tar [OPTION] DEST SOURCEeg. tar cvf/home/archive.tar/home/originaltar xvf/home/archive.tar zip – package and compress (archive) filesUsage: zip [OPTION] DEST SOURSEeg. zip original.zip original unzip – list, test and extract compressedfiles in a ZIP archiveUsage: unzip filenameeg. unzip original.zip

www.atozknowledge.com

Page 15: Basic Linux commands

ssh – SSH client (remote login program)“ssh is a program for logging into aremote machine and for

executing commands on a remote machine”Usage: ssh [options] [user]@hostnameeg. ssh -X [email protected]

www.atozknowledge.com

Page 16: Basic Linux commands

reboot – reboot the systemUsage: reboot [OPTION]eg. reboot poweroff – power off the systemUsage: poweroff [OPTION]eg. poweroff

www.atozknowledge.com