Sei sulla pagina 1di 21

09bc007

EXECUTION OF BASIC UNIX COMMANDS


skcet@NW1-143:~$ vi ar.txt ssdsadas asdsadsad asdadsa xzczxcre rt345345 fgdfgdf 34534543 asasdasdsa press i to insert text before the current cursor position. press I to insert text at the beginning of the line. press a to insert text after the cursor position. press A to insert text at the end of the current line. press o to open a new line below the current line. press O to open a new line above the current line. press r to replace the present character with a character. ssdsadas asdsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd weee qweeee 34534543 asasdasdsa press R to replace a group of characters from current cursor position. ssdsadas asdsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd weee qweeee 34534543 asasdasdsa press x to delete present character. ssdsadas adsadsad asdadsa

09bc007

xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd weee qweeee 34534543 asasdasdsa press J to join the next line to the end of the current line. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd weee qweeee 34534543 asasdasdsa press dd to delete the current line. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd weee qweeee 34534543 asasdasdsa 34534543 asasdasdsa press 4dd to delete 4 lines from the current line ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd 34534543 asasdasdsa press dw to delete the current word. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdfdfgdfgdfddddd asasdasdsa press 7dw to delete 7 words from the current word onwards. ssdsadas adsadsad asdadsa xzczxcre rt345345

09bc007

sdfsdfdffdfdfdfd press 30i*Esc (invisible command) to insert 30 *'s at the cursor position. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf******************************d press . to repeat the previous command. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf************************************************************d press u to undo the effect of the previous command on the document. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf******************************d press yy to copy the entire line in to the buffer. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf******************************d 1 change; before #118 28 seconds ago press yw to copy the entire word in to buffer. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf******************************d 1 change; before #154 28 seconds ago press p to place the copied or deleted information below the cursor. ssdsadas adsadsad asdadsa xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d press P to place the copied or deleted information above the cursor. ssdsadas adsadsad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre

09bc007

rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d :/raja searches for the string "raja" in the forward direction. Press n to repeat the search. ssdsadas adsadsad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d search hit BOTTOM, continuing at TOP n :?raja search for the string in the backward direction. Press n to repeat the above search. ssdsadas adsadsad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d search hit TOP, continuing at BOTTOM n :s/raja/rama replaces the first occurrence of "raja" with "rama". ssdsadas adhappysad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d :s/sad/happy :s/raja/rama/g replaces all rajas with rama in the present line. ssdsadas adhappyhappy asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d :s/sad/happy/g :g/raja/s/raja/rama/g replaces all "raja"s by "rama" in the entire file.

09bc007

ssdsadas adsadsad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d :g/happy/s/happy/sad/g :1d delete the line 1. dsadsad asdadsa sdfsdfdffdfdfdf******************************d xzczxcre rt345345 sdfsdfdffdfdfdf******************************d sdfsdfdffdfdfdf******************************d :1,5d deletes the lines from 1 to 5. sdfsdfdffdfdfdf******************************d skcet@NW1-143:~$ vi at.txt ssadsad saddsad xxxxxxxxxxx xxxxxxxxxx cxvcxvxcv xcvcxsdfsd xccxvxcvxcv adasd sdfdsfsfsd qweq ewqdsadsd asdasre ewrfsdf dsfsdf vdgdfg fdgdfgfg $ means last line of file ssadsad saddsad xxxxxxxxxxx xcvcxsdfsd xccxvxcvxcv adasd sdfdsfsfsd qweq ewqdsadsd asdasre ewrfsdf

09bc007

dsfsdf vdgdfg .means present line ssadsad saddsad xxxxxxxxxxx xxxxxxxxxx cxvcxvxcv xcvcxsdfsd xccxvxcvxcv adasd sdfdsfsfsd qweq asdasre ewrfsdf dsfsdf vdgdfg :10,$d deletes lines from 10th line to the last line of the file. ssadsad saddsad xxxxxxxxxxx xxxxxxxxxx cxvcxvxcv xcvcxsdfsd xccxvxcvxcv adasd sdfdsfsfsd :1,$d deletes lines from 1 to last line of the file. //empty :.,$d deletes lines from present line to the last line. ssadsad saddsad xxxxxxxxxxx xxxxxxxxxx cxvcxvxcv xcvcxsdfsd xccxvxcvxcv :.-3,.d deletes the lines from present line and above 2 lines ssadsad saddsad xxxxxxxxxxx :.,.+4d deletes the lines from the present cursor line followed 3 lines(total 4 lines). ssadsad saddsad Cfdsfsfsdf sdfsdfs

09bc007

erwer dsdfxxxxxxxxxx :-1,. +3d deletes the lines one above the cursor line followed by it 3 lines. ssadsad dsfdsf serewrwr rwer :18 cursor goes to 18 th line of the file. ssadsadf sdfsd asdfasd vffdgfdg sdfsdf asddsfgdfg :1,5 co 10 copies the lines from 1 to 5 after 10th line ssadsadf sdfsd sdcxzcx sdsaas asdasd t vffdgfdg sdfsdf asddsfgdfg :1,$ co $ copies the lines from 1 to last line after last line sdsaas asdasd t y u werwe werwe ssadsadf sdfsd ssadsadf sdfsd sdcxzcx sdsaas asdasd t y u werwe werwe ssadsadf sdfsd

09bc007

:.,.+5 co 8 copies lines from present line to 5 lines after 8th line ssadsadf sdfsd sdcxzcx sdsaas asdasd t y u u f dsfsdfsdf sd q q f dsfsdfsdf sd q q q q e :-3,. co 10 copies the lines from present cursor line and above 3 lines after 10 th line. sdfsd sdcxzcx sdsaas asdasd t y u u f dsfsdfsdf sd q q dsfsdfsdf sd q q :1,5 mo 9 moves lines from 1 to 5 after 9th line. y u u ssadsadf sdfsd sdcxzcx sdsaas

09bc007

asdasd f dsfsdfsdf sd q q dsfsdfsdf sd q q :1,$ mo $ moves lines from 1 to $ after last line. t y u u ssadsadf d :.,.+5 mo 10 moves lines from present line and next 5 t y u u ssadsadf Bdsfdsf Ddsfsd D sdf Ddsfsdf D Adfgdfddddd Aetgdg :.-3,. mo 10 moves present line and above 3 lines after 10 th line. u ssadsadf Bdsfdsf Ddsfsd D sdf Ddsfsdf D Adfgdfddddd Aetgd :1,5 w filename writes lines 1 to 5 in the specified filename. skcet@NW1-143:~$ vi aj.txt A lines after 10 th line onwards.

09bc007

b b v d f :1,5 w ar.txt skcet@NW1-143:~$ vi ar.txt A b b v d f :1,5 w! filename overwrites lines 1 to 5 in the specified filename. skcet@NW1-143:~$ vi aj.txt A b b v d f :1,5 w! ar.txt skcet@NW1-143:~$ vi ap.txt 1ret skcet@NW1-143:~$ vi ap.txt A b b v d f :r filename Adds the content of filename after the current line. dsfsdfsdf sd q q f dsfsdfsdf sd q q q q e :-3,. co 10 copies the lines from present cursor line and above 3 lines after 10 th line. sdfsd sdcxzcx

09bc007

sdsaas asdasd t y u u f dsfsdfsdf sd q q dsfsdfsdf sd q q skcet@NW1-143:~$ cp ar.txt /tmp skcet@NW1-143:~$ ls a1.txt ar.txt Documents new out.nam Videos aa at.txt Downloads niru out.tr WinFile aaa examples.desktop notes Pictures a.cpp csma.tcl firewall.rules ns-allinone-2.34 Public a.out Desktop Music ns-allinone-2.34.tar.gz Templates skcet@NW1-143:~$ cp/bin/ls/tmp/a.txt skcet@NW1-143:~$ ls a1.txt ar.txt Documents new out.nam Videos aa at.txt Downloads niru out.tr WinFile aaa a.txt examples.desktop notes Pictures a.cpp csma.tcl firewall.rules ns-allinone-2.34 Public a.out Desktop Music ns-allinone-2.34.tar.gz Templates

skcet@NW1-143:~$ mv at.txt ar.txt skcet@NW1-143:~$ ls a1.txt ar.txt examples.desktop notes Pictures aa csma.tcl firewall.rules ns-allinone-2.34 Public aaa Desktop Music ns-allinone-2.34.tar.gz Templates a.cpp Documents new out.nam Videos a.out Downloads niru out.tr WinFile skcet@NW1-143:~$ mv a.txt /tmp mv: cannot stat `a.txt': No such file or directory skcet@NW1-143:~$ mv *.cpp /tmp skcet@NW1-143:~$ ls

09bc007

a1.txt csma.tcl firewall.rules ns-allinone-2.34 Public aa Desktop Music ns-allinone-2.34.tar.gz Templates aaa Documents new out.nam Videos a.out Downloads niru out.tr WinFile ar.txt examples.desktop notes Pictures skcet@NW1-143:~$ cat ar.txt>a1.txt a1.txt dsfsdf sdfsdf sdf skcet@NW1-143:~$ wc -l a1.txt 21 a1.txt skcet@NW1-143:~$ wc -w a1.txt 19 a1.txt skcet@NW1-143:~$ wc -c a1.txt 88 a1.txt skcet@NW1-143:~$ nl a1.txt 1 t 2 y 3 u 4 u 5 ssadsadf skcet@NW1-143:~$ tail a1.txt u ssadsadf d D sdf Ddsfsdf D Adfgdfddddd Aetgdg skcet@NW1-143:~$ tail -1 a1.txt D sdf Ddsfsdf D Adfgdfddddd Aetgdg skcet@NW1-143:~$ tail +2 a1.txt ==> a1.txt <== u ssadsadf d D

09bc007

sdf Ddsfsdf D Adfgdfddddd Aetgdg skcet@NW1-143:~$ head a1.txt t y u u ssadsadf Bdsfdsf Ddsfsd t y skcet@NW1-143:~$ head -2 a1.txt t y skcet@NW1-143:~$ mkdir op skcet@NW1-143:~$ cd op skcet@NW1-143:~/op$ skcet@NW1-143:~$ pwd /home/skcet skcet@NW1-143:~$ uniq -c a1.txt 1t 1y 2u 1 ssadsadf 1 1 Bdsfdsf 1 Ddsfsd 1t 1y 2u skcet@NW1-143:~$ grep "sad" a1.txt ssadsadf ssadsadf skcet@NW1-143:~$ grep "[dD]sf" a1.txt Bdsfdsf Ddsfsd Ddsfsdf skcet@NW1-143:~$ grep "^Dd" a1.txt Ddsfsd Ddsfsdf skcet@NW1-143:~$ grep "dg$" a1.txt Aetgdg skcet@NW1-143:~$ grep "^D$" a1.txt

09bc007

D D skcet@NW1-143:~$ grep -n "sad" a1.txt 5:ssadsadf 13:ssadsadf skcet@NW1-143:~$ ls -l a1.txt -rw-r--r-- 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ chmod 700 a1.txt skcet@NW1-143:~$ ls -l a1.txt -rwx------ 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ chmod 000 a1.txt skcet@NW1-143:~$ ls -l a1.txt ---------- 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ chmod u=rwx a1.txt skcet@NW1-143:~$ ls -l a1.txt -rwx------ 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ chmod u-x,go+r a1.txt skcet@NW1-143:~$ ls -l a1.txt -rw-r--r-- 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ id uid=1000(skcet)gid=1000(skcet) groups=1000(skcet),4(adm),20(dialout),24(cdrom),46(plugdev),112(lpadmin),120(admin),122(sam bashare) df command: skcet@NW1-143:~$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda10 48060296 3090348 42528580 7% / none 1652276 656 1651620 1% /dev du command: skcet@NW1-143:~$ du 8 ./.gconf/apps/nm-applet 8 ./.gconf/apps/evolution/calendar/notify 16 ./.gconf/apps/evolution/calendar skcet@NW1-143:~$ du a1.txt 4 a1.txt skcet@NW1-143:~$ ls -l a1.txt -rw-r--r-- 1 skcet skcet 88 2011-12-09 10:09 a1.txt skcet@NW1-143:~$ du -b a1.txt

09bc007

88

a1.txt

who command: skcet@NW1-143:~$ who skcet tty7 1997-12-09 08:46 (:0) skcet pts/0 2011-12-09 09:03 (:0.0) skcet@NW1-143:~$ w 10:36:43 up 1:50, 2 users, load average: 0.14, 0.13, 0.08 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT skcet tty7 :0 08:46 5113days 1:30 0.10s gnome-session

skcet@NW1-143:~$ rm aa skcet@NW1-143:~$ ls a1.txt Desktop examples.desktop ns-allinone-2.34 Pictures aaa dfsdf firewall.rules ns-allinone-2.34.tar.gz Public aa.txt df.txt Music ooo Templates a.out Documents new op Videos ar.txt Downloads niru out.nam WinFile csma.tcl er notes out.tr man ls NAME ls - list directory contents SYNOPSIS ls [OPTION]... [FILE]... DESCRIPTION List information about the FILEs (the current directory by default). Sort entries alphabetically if none of -cftuvSUX nor --sort. Mandatory arguments to long options are mandatory for short options NAME cp - copy files and directories SYNOPSIS cp [OPTION]... [-T] SOURCE DEST cp [OPTION]... SOURCE... DIRECTORY cp [OPTION]... -t DIRECTORY SOURCE... DESCRIPTION

09bc007

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. NAME mv - move (rename) files SYNOPSIS mv [OPTION]... [-T] SOURCE DEST mv [OPTION]... SOURCE... DIRECTORY mv [OPTION]... -t DIRECTORY SOURCE... DESCRIPTION Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY. Mandatory arguments to long options are mandatory for short options too. NAME cat - concatenate files and print on the standard output SYNOPSIS cat [OPTION] [FILE]... DESCRIPTION Concatenate FILE(s), or standard input, to standard output. NAME wc - print newline, word, and byte counts for each file SYNOPSIS wc [OPTION]... [FILE]... wc [OPTION]... --files0-from=F DESCRIPTION Print newline, word, and byte counts for each FILE, and a total line if more than

09bc007

one FILE is specified. With no FILE, or when FILE is -, read standard input. NAME nl - number lines of files SYNOPSIS nl [OPTION]... [FILE]... DESCRIPTION Write each FILE to standard output, with line numbers added. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too.

NAME tail - output the last part of files SYNOPSIS tail [OPTION]... [FILE]... DESCRIPTION Print the last 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. NAME head - output the first part of files SYNOPSIS head [OPTION]... [FILE]... DESCRIPTION Print the first 10 lines of each FILE to standard output. With more than one FILE, precede each with a header giving the file name. With no FILE, or when

09bc007

FILE is -, read standard input. NAME mkdir - make directories SYNOPSIS mkdir [OPTION] DIRECTORY... DESCRIPTION Create the DIRECTORY(ies), if they do not already exist. NAME rmdir - remove empty directories SYNOPSIS rmdir [OPTION]... DIRECTORY... DESCRIPTION Remove the DIRECTORY(ies), if they are empty. NAME pwd - print name of current/working directory SYNOPSIS pwd [OPTION] DESCRIPTION Print the full filename of the current working directory. NAME uniq - report or omit repeated lines SYNOPSIS uniq [OPTION]... [INPUT [OUTPUT]] DESCRIPTION Discard all but one of successive iden-tical lines from INPUT (or standard input), writing to OUTPUT (or standard output). NAME

09bc007

grep, egrep, fgrep - print lines match-ing a pattern SYNOPSIS grep [options] PATTERN [FILE...] grep [options] [-e PATTERN | -f FILE] [FILE...] DESCRIPTION Grep searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines con-taining a match to the given PATTERN. By default, grep prints the matching lines. NAME chmod - change file mode bits SYNOPSIS chmod [OPTION]... MODE[,MODE]... FILE... chmod [OPTION]... OCTAL-MODE FILE... chmod [OPTION]... DESCRIPTION This manual page documents the GNU ver-sion of chmod. chmod changes the file mode bits of each given file according to mode, which can be either a symbolic representation of changes to make, or an octal number representing the bit pat-tern for the new mode bits. NAME chown - change file owner and group SYNOPSIS chown FILE... chown [OPTION]... DESCRIPTION This manual page documents the GNU ver-sion of chown. chown changes the user and/or group ownership of each given file. NAME --reference=RFILE [OPTION]... [OWNER][:[GROUP]] --reference=RFILE

09bc007

chgrp - change group ownership SYNOPSIS chgrp [OPTION]... GROUP FILE... chgrp FILE... DESCRIPTION Change the group of each FILE to GROUP. With --reference, change the group of each FILE to that of RFILE. NAME id - print user identity [OPTION]... --reference=RFILE

SYNOPSIS id [OPTION]... [USERNAME] DESCRIPTION Print information for USERNAME, or the current user. NAME df - report file system disk space usage SYNOPSIS df [OPTION]... [FILE]... DESCRIPTION This manual page documents the GNU ver-sion of df. df displays the amount of disk space available on the file system containing each file name argument. NAME du - estimate file space usage SYNOPSIS du [OPTION]... [FILE]... du [OPTION]... --files0-from=F

09bc007

DESCRIPTION Summarize disk usage of each FILE, recursively for directories. NAME who - show who is logged on SYNOPSIS who [OPTION]... [ FILE | ARG1 ARG2 ] DESCRIPTION -a, --all same as -b -d --login -p -r -t -T -u -b, --boot time of last system boot NAME w - Show who is logged on and what they are doing. SYNOPSIS w - [husfV] [user] DESCRIPTION w displays information about the users currently on the machine, and their pro-cesses. NAME rm - remove files or directories SYNOPSIS rm [OPTION]... FILE... DESCRIPTION This manual page documents the GNU ver-sion of rm. rm removes each specified file. By default, it does not remove directories.

RESULT Thus the basic unix commands has been implemented successfully.

Potrebbero piacerti anche