Lap 1 Directory and Files Mangment
Lap 1 Directory and Files Mangment
1. Whoami
[root@localhost ~]# whoami // to know the current user just write whoami
2. ls command
[root@localhost ~]# ls // list show contents in your directory
3. ls -a command
[root@localhost ~]# ls -a // show your files so hidden files in your system directory
4. cd command
[root@localhost ~]# cd Music // this command used for navigation between directories”
5. home directory
[root@localhost ~]# cd /home // show you home directory, where all the users has stored e.g Mahdi
[root@localhost home]# ls
anoher example. Compound two files in one file by using cat command
[rooot@localhost ~]# cd Desktop
[rooot@localhost Desktop]# cat >mahdi1
I wana to be network administrate
[rooot@localhost Desktop]# cat >mahdi2
The quick brown fox jumps over the lazy dog
The quick brown fox jumps over the lazy dog
[rooot@localhost Desktop]# cat mahdi1 mahdi2 >elmi // we assigned elmi, the files mahdi1 and 2
9. Creating directories
[rooot@localhost ~ ]# cd Desktop/
[rooot@localhost Desktop]# mkdir Eelo //create a directory called Eelo
[rooot@localhost Desktop]# ls // check it that the directory we have been created on the desktop or not
12. Copy the file from Desktop to Documents by using absolute path
[root@localhost~ ]# cd Desktop
[root@localhost Desktop]# cp /root/Desktop/lap /root/Documents/ // copy file from Desk.. to Docu…
12. Copy the File/directory form Desktop to Music by using relative path
[root@localhost Desktop]# cp oracle /root/Music // file copy by relative path
[root@localhost Desktop]# cp oracle -r /root/Music // copy Directory by relative path
13. Copy file/directory from the root to normal user by using absolute path
[root@localhost Music]# cp /root/Desktop/Lap /home/mobsiyeh/Documents/ // copy file from root to normal user
[root@localhost Music]# cp –r /root/Desktop/Unix /home/mobsiyeh/Documents/ // copy Directory from root to normal
user
19. pwd - print working directory, is a Linux command to get the current working directory.
[root@localhost Desktop]# pwd
/root/Desktop
20. clear