Unix Commands
Unix Commands
UNIX COMMANDS
File Management
ls
ls l
ls ch*.doc
Displays all the files whose name start with ch and ends
with .doc
ls a
vim filename
cat filename
cat b filename
cp source_file
destination_file
mv old_file new_file
rm filename
8/4/16
Directory Management
ls dirname
mkdir dirname
rmdir dirname
cd dirname
mv olddir
newdir
. (dot)
.. (dot dot)
/ (slash)
~ (tilde)
pwd
8/4/16
grep command
Used to search a file or files for lines that have a certain pattern
grep pattern file/files
Some options are listed below
Example of pipes
ls -l | grep "Aug" | sort +4n
-rw-rw-r--rw-rw-r--rw-rw-rw-rw-rw-rw-
1
1
1
1
carol
john
john
john
doc
doc
doc
doc
1605
2488
8515
11008
VIM editor
Two modes Command and Edit
Command Mode Used to perform tasks like saving, copy-paste, findreplace, etc.
Edit Mode Used to edit the file by writing into it
Some commands:-
8/4/16
:q
Quit vi, raises warning if file is changed
:q!
Quit without saving any changes
:w
Save all changes in the file
:wq
Save and quit
ZZ
Save and quit
:w nfile
Saves the current file with a different filename nfile
8/4/16
8/4/16
10
y to copy
Move the cursor to the location where the text has to be pasted
Press
p to paste
8/4/16
11
THANK YOU
8/4/16
12