Sunday, August 9, 2009

Linux Basic Commands

The Bais command of Linux..easy usage easy learn
For changing directory / to /etc
[root@pc1 /]# cd /etc
One step back /etc to /
[root@pc1 etc]# cd ..
Go to previous working directory
[root@pc1 /]# cd -
Go to current login user home directory
[root@pc1 etc]# cd ~
Show the contents of /etc in single color
[root@pc1 ~]# dir /etc
Show the contents of /etc in different colors with nature of contents
[root@pc1 ~]# Ls /etc
create a folder on root partition
[root@pc1 ~]# mkdir /disk
Create a folder in /disk
[root@pc1 ~]# mkdir /disk/dir
Create multiple folder in multiple directories with single command
[root@pc1 ~]# mkdir /etc/dir1 /var/dir2 /usr/dir3
Create multiple folder in same directory
[root@pc1 ~]# mkdir dir1 dir2 dir3
Copy a file in directory
[root@pc1 disk]# cp file dir
Copy a file from /disk/file and paste it in /disk/dir/
[root@pc1 disk]# cp /disk/file /disk/dir
Copy a directory with –r option
[root@pc1 disk]# cp -r dir dir2
Copy a file from /disk/file and paste it in /etc with myfile name
[root@pc1 disk]# cp /disk/file /etc/myfile
Remove a file
[root@pc1 disk]# rm file
Remove a file with forcefully option
[root@pc1 disk]# rm –f file
Remove a directory with out –r option and you face will an error
[root@pc1 disk]# rm dir
Remove a directory with –r option
[root@pc1 disk]# rm -r /disk
Remove a directory with forcefully option
[root@pc1 disk]# rm -rf dir
Move /etc/dir1 to /disk/ with different name
[root@pc1 disk]# mv /etc/dir1 /disk/mydir

No comments:

Post a Comment