Powered By Blogger

Tuesday, May 3, 2011

Working with Files in Linux

c r e a t i n g    f i l e s
syntax:
cat > filename
  content
  content
  content
e.g.:
cat > todo_list
  eat
  rest
  sleep
* use ctrl + D to denote the end of the line

d i s p l a y i n g    f i l e    c o n t e n t s
syntax:
cat filename
e.g.:
cat todo_list

r e m o v i n g    f i l e s
syntax:
rm filename
e.g.:
rm todo_list

c o p y i n g    f i l e s
syntax:
cp oldfilename newfilename
e.g.:
cp old.pdf new.pdf
* copy the contents of the file to another file

r e n a m i n g    f i l e s
syntax:
mv oldfilename newfilename
e.g.:
mv oldfilename.txt newfilename.txt

f i l e n a m e    c o m p l e t i o n
press Tab key

No comments:

Post a Comment