Pages

Monday 2 April 2012

Unix Commands which should be on tips of each developer

General Commands:

1. date: shows date and time
2. history: lists the previously executed commands
3. man ls: shows online documentation by program name
4. who: who is on the system and what they are doing
5. whoami: who is logged onto this terminal
6. cal: calendar
7. banner DZone 
8. clear: clears the screen
9. tty: displays your terminal

Directory Management Commands:

1. pwd: will print your home directory on screen. pwd means print working directory
2. ls: displays the contents of directory
3. cd: change to new directory
4. mkdir dirNameCreate: creates new directory
5. mv dirNameChange dirNameChange2: renames the directory           
6. rmdir dirNameremove: removes empty directory (you must remove files first)
7. dircmp dir1 dir2: compares two directories

File Management Commands:

1. find myFile.txt: finds files that match specific criteria  
2. file myFile.txt: displays about the contents of a given file, whether it is a text (Ascii) or binary file.
3. head myFile.txt: by default it will display the first 10 lines of a file.
If you want first 50 lines you can use head -50 filename or for 37 lines head -37 filename and so forth.
4. tail myFile.txt: by default it will display the last 10 lines of a file.
If you want last 50 lines then you can use tail -50 filename.
5. more myFile.txt: will display a page at a time and then wait for input which is spacebar. For example if you have a file which is 500 lines and you want to read it all.
6. wc myFile.txt: counts the characters, words and lines in a file depending upon the option
7. mv myFile.txt yourFile.txt: is used to move a file from one directory to another directory or to rename a file
8. cp myFile.txt yourFile.txt: is used to copy a file from one directory to another directory/same directory
9. rm myFile.txt: removes the file
10. cmp myfile.txt yourfile.txt: compares two files

No comments:

Post a Comment