Object management command

Files (Text Base)

Create new file

[root@daddylinux~]#nano filename
[root@daddylinux~]#nano /etc filename
[root@daddylinux~]#touch filename
[root@daddylinux~]#touch /etc filename

To edit file

[root@daddylinux~]#nano filename
Read file

[root@daddylinux~]#nano filename
[root@daddylinux~]#cat filename
[root@daddylinux~]#cat filename |more

Read first 10 lines

[root@daddylinux~]#head filename
[root@daddylinux~]#head –n5 filename (Display first 5 lines)

Read final 10 lines

[root@daddylinux~]#tail filename
[root@daddylinux~]#tail –n5 filename (Display last 5 lines)

Create folder

[root@daddylinux~]#mkdir foldername
[root@daddylinux~]#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@daddylinux~]# ln -s DestinationFolderPath SymlinkName

01. Change your home folder
[root@daddylinux~]#cd

02. Create symlink (symlink name uddika)
[root@daddylinux~]#ln –s /usr/share/background/images uddika

03. Check the link
[root@daddylinux~]#ls –l

04. Go to symlink
[root@daddylinux~]#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
[root@daddylinux~]#cd

02. Create symlink (symlink name uddika)
[root@daddylinux~]#ln –s /boot/grub/grub.conf uddika

03. Check the link
[root@daddylinux~]#ls –l

04. Go to symlink
[root@daddylinux~]#nano uddika

Renaming the object (File, Folder and Symlink)
Syntax - [root@server ~]# mv CurrentObjectName NewObjectName
[root@daddylinux~]# mv Grub GrubConf

Moving object (Cut & Paste)
Syntax - [root@server ~]# mv ObjectName NewLocation
[root@daddylinux~]# mv bat /usr/share/background/images

Copying object

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

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

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

Deleting Object
Files and Symlinks
Syntax - [root@daddylinux~]# rm -f ObjectName
[root@daddylinux~]# rm -f text1

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

0 comments:

Post a Comment