Sei sulla pagina 1di 5

www.computerhope.com/unix/overview.htm Commands: cd - Takes you to the home directory.

pwd - To see where you are now mkdir - to create a new directory cd "name of the directory" - you will be entering the directory touch - is used to create files ls - to list all the files in the current directory ls -l - lists all the documents in the directory ls -lrt - lists all the directory and files in a directory with the recursive ti me of modification cd .. - goes back to the previous directory cd ../.. - goes 2 directories before ps - shows all the processors runnning in the system ls -l *'last letter of the file' - finds the file that has the name ends with th e same letter ls -l 'first letter of the file'* - finds the file with the name that starts wit h the same letter ls -lart - displays all the hidden files ls -a - displays all the files including the hidden files cat > filename - lets you write informations in the particular file cat filename - lets you see what is written in the particular filename man 'command' - gives a brief description about the command and for coming out g ive 'Q' man -k 'command' - displays all the lines where the command is used man -a 'command' - displays all the pages where the command is used rmdir 'directory name' - deletes the directory only if its empty rm 'filename' - deletes the file rm -r 'directory name' - deletes the directory even if the directory is not empt y who - displays all the users in the same address who -m - displays informations about the terminal where the user(you) has logged in

who -q - displays informations about the number of users which 'command name' - displays in which directory the command is used passwd - to change password cat 'file1' 'file2' - concatenation of file 1 and file 2 cat -n 'filename' - displays the number of lines in the file cp 'file1' 'file2' - to copy the contents of file 1 to file 2 cp -i 'file1' 'file2' - to copy the contents of file 1 to file 2 with prior conf irmation whether to overwrite or not. cp 'path1' 'path2' - to copy file from one directory to another cp 'directory1' 'directory2' - to copy directory1 to directory 2 and if both the directories are in different location then the path for the directory is to be given. i.e cp 'path1 of di r1' 'path2 of dir2' mv 'path1' 'path2' - to move the file find . -name 'name of the file' - finds the specific file in the same directory and the preceding child directories cmp 'file1' 'file2' - Compares file1 and file2. if files are identical then it w ill not return any message. if not then it will display the first byte where the files differ diff 'file1' 'file2' - compares two files 1 and 2 and displays where the two fil es differ diff -b 'file1' 'file2' - same function as above but this one ignores the traili ng blank spaces which differ in both the files ln -s 'filename' 'shortcut' - a shortcut is created for that particular file less filename - displays the contents of the file in a pagewise manner. ctrl+d t o move forward and ctrl+b to move backward head '-no. of lines' 'filename' - displays the first specified no. of lines in t he file and the 'no. of lines' thing is optional. if its not given then first 10 lines is displayed tail '-no . of lines' 'filename' - displays the last specified no. of lines in t he file and the 'no. of lines' thing is optional. if its not given then last 10 lines is displayed more filename - displasy a very long file by some percentage and we can scroll o ne line at a time. And its user-friendly. chmod - changes the mode (permission for owner, group and others). Permissions a re RWX 1. read (2^2) 2. write (2^1) 3. execute (2^0) chmod 700 filename - changes the existing permission of file to rwx for user and

removes all permission for group and others. Now 7 represents owner, 0 represents group, 0 represents others if rwx = 0 = no 1 2 3 4 5 6 7 permission (minimum value) = execute = write = execute + write = read = read + execute = read + write = read + write + execute

chmod go+r filename - assigns permission r to group and others chmod go-r go+w - assings permission w to group and others and removes permissio n r to group and others chmod -R go+rwx - assigns rwx permission to group and others not only in the di rectory but also in the files and sub-directories mkdir ../bin - make a new directory in previous directory not in the current dir ectory rmdir .. - removes the previous directory (but mostly it wil not work) ls .. - lists all the files in the previous directory sort filename - to arrange the contents of the file in ascending order sort -n filename - to arrange the contents of the file in ASCII value order grep 'content' 'filename' - to search for a specific content in a file. content - if a single word, type it sim ply and if its a line, enclose it in " " uniq filename - displays the contents of the file but the consecutive repeated l ines are displayed only once uniq -u filename - omits consecutive repeated lines as a whole wc filename - displays the number of lines, words and characters in the same ord er wc -l filename - displays the number of lines wc -w filename - displays the number of words ls -l - gives the number of files cut -c(number-number), (number-number) filename - extracts specified characters from the file cut -d " " -f(number-number) filename - extracts specified fields alone and diap lays (columns must be symmetric) "d" stands for the delimiter "f" stands for field paste file1 file2 - paste the two files vertically paste -d file1 file2 - pastes the two files along with delimiter

lpr - to print lprm - to cancel the documents waiting for printing lpq -to see what document is in the printing process at present lprm number - to cancel the nth document sent for printing ping 'server name' - to check other server status(alive or not) telnet 'server name' - to connect to another server netstat -an - to check how many network connections are made with the port tar -cvf 'tar filename' file1 file2 - to create a collection (zip file) by combi ning many files v - shows f - filename tar -vxf 'tar filename' - to extract the tar file x - extract gzip filename - to compress a file gunzip filename - to extract the gzip file ps - by default displays all active processes. displays process id (pid), paren t process id (ppid) etc. kill 'pid' - to kill that process.. never kill ppid kill -9 - end all the process & - to show the process at background without showing the output at - to run the process at a particular time (specific date and time) crontab - runs the process automatically at regular intervals join file1 file2 - to join two files VI Editor: #type vi filename #press i for insert mode #type the content #press esc (by which goes out of insert mode and enters command mode) #press : and w tp save #press q and enter to quit q or q! to quit without saving In command Mode: h j k l 0 $ cursor moves left cursor moves down cursor moves up cursor moves right goes to the begining of the line goes to the end of the line

w - moves one word to the right b - moves one word to the left i - to toggle to insert mode esc - to toggle to command mode r - to replace the particular character with any other character (takes the curs or to insert mode temporarily) dd - delete the entire line yy - yanks a line i.e copies c - cut a line p - paste a line shift+a - it will go to the end of the line and enters insert mode

Potrebbero piacerti anche