blogger templates blogger widgets
This is part of a list of blog posts.
To browse the contents go to

Shell commandS

Only the few of the most important commands are discussed here.

cd : to change directory.

cd ..
will go one step above.
cd ./temp
is same as cd temp.
cd –
will take you to the previous directory which you used.
cd ~
will take to home directory.
cd /
will take to root directory.


eipe@eipe-system://usr/lib$ cd ~
eipe@eipe-system:~$ cd -
//usr/lib
eipe@eipe-system://usr/lib$


mkdir : to create directory.

mkdir dir1 dir2
will create 2 directories dir1 and dir2 in the current directory.

cp : copy command

cp file1 file2
Copy file1 to file2. If file2 exists, it is overwritten with the contents of file1. If file2 does not exist, it is created. In either case, both files exists.

cp /vol/examples/tutorial/science.txt .
common options are:
-r : to recursively copy directories and their contents. This option (or the -a option) is required when copying directories.
-a : Copy the files and directories and all of their attributes, including ownerships and permissions. Normally, copies take on the default attributes of the user performing the copy.
-i : if file2 exists, the user is prompted before it is overwritten.

cp file1 file2 file3 dir1
Copy file1, file2, file3 into directory dir1. dir1 must already exist.
cp dir1/* dir2
All the files in dir1 are copied into dir2. dir2 must already exist.

mv : move command

mv file1 file2
Move file1 to file2. If file2 exists, it is overwritten with the contents of file1. If file2 does not exist, it
is created. In either case, file1 ceases to exist.

mv file1 file2 dir1
Move file1 and file2 into directory dir1. dir1 must already exist.

rm : to remove files or directories.

rm file1
Delete file1 silently.
rm -i file1
Same as above, except that the user is prompted for confirmation before the deletion is performed.
rm -r file1 dir1
Delete file1 and dir1 and its contents.
rm -f file1
-f option is used to force delete. It means that if the file does exist it will be deleted else if it doesn't no error message is printed simillar to
rm: cannot remove `': No such file or directory
-f option to suppresses these messages. It's useful when u write scripts to delete files silently and automatically at a specific time.

Note:
-v option is used with most of the commands (rm, cp...) it prints a msg about what it had performed.

login
To login as root/super user

sudo su
To login as any other user

login

1 comment:

  1. Johnie ..good one..i was expecting something like this from you

    ReplyDelete