Learning Bash-Shell Commands-Tutorial-3

1. mv command : It is used for file from one directories to another.You have to first enter the file_name(that you want to move) and then
the new location of that file.
SYNTAX : mv filename new_location
rk10@rk-desktop:~/Desktop/log$ ls
passwd.txt
rk10@rk-desktop:~/Desktop/log$ cd ../
rk10@rk-desktop:~/Desktop$ cd test
rk10@rk-desktop:~/Desktop/test$ ls
login.txt  xyz.txt
rk10@rk-desktop:~/Desktop/test$ mv login.txt /home/rk10/Desktop/log
rk10@rk-desktop:~/Desktop/test$ cd ../log
rk10@rk-desktop:~/Desktop/log$ ls
login.txt  passwd.txt
rk10@rk-desktop:~/Desktop/log$

2. mkdir commmand : It is used for creating new directories.You have to just specify the name of the directory after mkdir,it will create a directory in the current working directory.
SYNTAX : mkdir : mkdir new_directory
rk10@rk-desktop:~/Desktop/log$ ls
login.txt  passwd.txt
rk10@rk-desktop:~/Desktop/log$ mkdir eagle
rk10@rk-desktop:~/Desktop/log$ ls
eagle login.txt  passwd.txt
rk10@rk-desktop:~/Desktop/log$

3. less command : Its works as a text reader because it can display text files contents.
SYNTAX : less file_name.txt
rk10@rk-desktop:~/Desktop/log$ less login.txt //press CTRL+Z to come back to command promopt.
this is the content of the file login.txt….
[1]+  Stopped                 less login.txt
rk10@rk-desktop:~/Desktop/log$

4. stat command : It is very usefull in veiwing file statistics,e.g creation date,modification date etc.stat command gives the complete status of the file.
SYNTAX : stat file_name
rk10@rk-desktop:~/Desktop/log$ stat login.txt
File: `login.txt’
Size: 37 Blocks: 8          IO Block: 4096   regular file
Device: 808h/2056d Inode: 1024062     Links: 1
Access: (0644/-rw-r–r–)  Uid: ( 1000/rk10)   Gid: ( 1000/rk10)
Access: 2010-03-14 19:31:46.000000000 +0530
Modify: 2010-03-14 19:31:25.000000000 +0530
Change: 2010-03-14 19:31:25.000000000 +0530
rk10@rk-desktop:~/Desktop/log$

Leave a comment

Your email address will not be published. Required fields are marked *