ls
ls command is used to display files and directories. Syntax is
ls
ls –l
it is used to display files and directories in a long format (i.e. with permissions, owner name, group name, links, size, creation date etc.. )
cp
it is used to copy a file from one location to another location. Syntax is
cp
e.g. cp /home/kishor/xyz /home/kishor/personal
above command will copy xyz file from /home/kishor directory to /home/kishor/personal directory
mv
it is used to move a file from one location to another location. Syntax is
mv
e.g. mv /home/kishor/xyz /home/kishor/personal
above command will move xyz file from /home/kishor directory to /home/kishor/personal directory
mv command can also be used to rename a file
eg mv xyz abc
this command will rename xyz file to abc file.
who
it is used to display information about the users who are currently logged on. Syntax is
who
head
it is used to display the first n lines of a file. Syntax is
head –n
where n is the number of lines.. eg
head –10 abc
above command will display the first 10 lines of abc file
tail
it is used to display the last n lines of a file. Syntax is
tail –n
where n is the number of lines
eg. tail –10 abc
above command will display the last 10 lines of abc file
cat
cat command is used in 3 ways.
1. it can be used to display the content of a file. Eg.
cat abc
it will display the content of abc file
2. it can be used to create a file eg
cat > abc
it will create a file with the name abc. User will type the content of the file and can save the file by pressing ctrl+d.
3. it can be used to add content to a file. Eg
cat >> abc
it will give the chance to user to add some data to abc file.. user can save the updated file by pressing ctrl+d
No comments:
Post a Comment