Linux Tutorial 06


rm – Remove Files And Directories


Delete zikzak_file_01 silently

$ ls -l
total 12
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:10 archive
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:11 archive02
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:12 archive03
-rw-r----- 1 zikzak u41687    0 Aug  2 17:05 zikzak_file_01
-rw-r----- 1 zikzak u41687    7 Aug  2 17:09 zikzak_file_02
-rw-r----- 1 zikzak u41687    7 Aug  2 17:09 zikzak_file_03

$ rm zikzak_file_01

$ ls -l
total 12
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:10 archive
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:11 archive02
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:12 archive03
-rw-r----- 1 zikzak u41687    7 Aug  2 17:09 zikzak_file_02
-rw-r----- 1 zikzak u41687    7 Aug  2 17:09 zikzak_file_03

Delete zikzak_file_01 after confirmation

$ rm -i zikzak_file_02
rm: remove regular file `zikzak_file_02'? y

$ ls -l
total 12
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:10 archive
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:11 archive02
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:12 archive03
-rw-r----- 1 zikzak u41687    7 Aug  2 17:09 zikzak_file_03

Delete the file  zikzak_file_03 and the directory archive03

$ rm -r zikzak_file_03 archive03

$ ls -l
total 8
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:10 archive
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:11 archive02

Same as above, except that if either file or directory do not exist, rm will continue silently.

$ rm -rf zikzak_file_01 archive02

$ ls -l
total 4
drwxr-x--- 2 zikzak u41687 4096 Aug  2 17:10 archive


Linux Tutorial 05


cp – Copy Files And Directories


  • Copy zikzak_file_01 to zikzak_file_02.
  • If zikzak_file_02 exists, it is overwritten with the contents of zikzak_file_01.
  • If zikzak_file_02 does not exist, it is created.
$ ls -l
total 0
-rw-r----- 1 zikzak u41687 0 Aug  2 17:05 zikzak_file_01

$ cp zikzak_file_01 zikzak_file_02

$ ls -l
total 0
-rw-r----- 1 zikzak u41687 0 Aug  2 17:05 zikzak_file_01
-rw-r----- 1 zikzak u41687 0 Aug  2 17:07 zikzak_file_02

Continue reading

Zik Zak Coder !!!

Needless to say This is the first ever post in my life. Either being active online in social networks or technical blogging was never an exciting thing for me. However this idea of having my own online Journal had been creeping my mind for quite few months now. Today is that fine day when I opened up and went online.

I started this blog to keep a record of those little things that I do in my job, those great things that I learn from my colleagues, those trivial things that I tend to forget though needed handy for future references.I am sure this is a good beginning and hoping to keep up the momentum. Wish me good luck !!!

— Zik Zak Coder

post