Thursday, September 3, 2015

RHEL:- Copy, move, remove file directory

Create file, directories and link, copy and move.
a. Create/touch: touch file
$ gedit filename [ using GUI ]
$ vi filename
$ touch /tmp/i_was_here
b. Move/rename: mv sourcefile destfile
$ mv /tmp/httpd.conf /var/httpd/conf/httpd.conf
c. Remove: rm file [ rename/delete ]
$ rm /tmp/httpd.conf.old
$ rmdir /tmp/mydir (must be emply)
$ rm -rf /tmp/mydir
$ \rm -rf /tmp/mydir
d. Copy: cp sourecfile destfile
$ cp httpd.conf httpd.conf.date
$ cp -r /tmp/myfir /var/www/html/web

e. Create hard and soft links
1. Soft link: ln -s sourecfile destlink
$ ln -s /export/home/users /home/users
2. Hard link: ln sourecfile destlink
$ ln /export/home/users /home/users # must be same FS.
# note: because hardlink usage same ipnode, so can't cross the FS

Q. What is the difference between soft and hard link? Why do you create soft/hard link?

No comments:

Post a Comment