Object management command

Files (Text Base)

Create new file

#nano filename
#nano /etc filename
#touch filename
#touch /etc filename

To edit file

#nano filename

Read file

#nano filename
#cat filename
#cat filename |more

Read first 10 lines

#head filename
#head –n5 filename (Display first 5 lines)

Read final 10 lines

#tail filename
#tail –n5 filename (Display last 5 lines)

Create folder

#mkdir foldername
#mkdir /etc foldername

Create Symlink (Short cut)
Symlink pointing to folder

Create a symlink in your home folder to access “/usr/share/background/images” folder

Syntax - [root@server ~]# ln -s DestinationFolderPath SymlinkName

01. Change your home folder
#cd

02. Create symlink (symlink name uddika)
#ln –s /usr/share/background/images uddika

03. Check the link
#ls –l

04. Go to symlink
#cd uddika

Symlink pointing to file

Create a symlink in your home folder to access “/boot/grub/grub.conf”

Syntax - [root@server ~]# ln -s DestinationFilePath SymlinkName

01. Change your home folder
#cd

02. Create symlink (symlink name uddika)
#ln –s /boot/grub/grub.conf uddika

03. Check the link
#ls –l

04. Go to symlink
#nano uddika

Renaming the object (File, Folder and Symlink)

Syntax - [root@server ~]# mv CurrentObjectName NewObjectName
[root@server ~]# mv Grub GrubConf

Moving object (Cut & Paste)

Syntax - [root@server ~]# mv ObjectName NewLocation
[root@server ~]# mv bat /usr/share/background/images



Copying object
Files
Syntax - [root@server ~]# cp FileName NewLocation
[root@server ~]# cp ball /usr/share/background/images

Folder
Syntax - [root@server ~]# cp -r FolderName NewLocation
[root@server ~]# cp -r /home/samba /tmp

Symlink
Syntax - [root@server ~]# cp -d FileName NewLocation
[root@server ~]# cp -d /home/samba /tmp

Deleting Object

Files and Symlinks
Syntax - [root@server ~]# rm -f ObjectName
[root@server ~]# rm -f text1

Folders
Syntax - [root@server ~]# rm -rf FolderName
[root@server ~]# rm -rf ebook


------------------------------------------------------------------------------------------

0 comments: