0% found this document useful (0 votes)
12 views

Day - 3 Basic Commands3

To navigate directories, you can use the cd command followed by the path of the directory you want to change to. You can go up one level with cd .., go to the previous working directory with cd -, or go to the home directory with cd or cd ~. To remove files or directories, use the rm command followed by the file or directory name. For empty directories, use rmdir. To remove a directory and its contents, use rm -rf. To copy files or directories, use the cp command along with the source and destination paths. For directories, use cp -r to copy recursively.

Uploaded by

Deepak
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Day - 3 Basic Commands3

To navigate directories, you can use the cd command followed by the path of the directory you want to change to. You can go up one level with cd .., go to the previous working directory with cd -, or go to the home directory with cd or cd ~. To remove files or directories, use the rm command followed by the file or directory name. For empty directories, use rmdir. To remove a directory and its contents, use rm -rf. To copy files or directories, use the cp command along with the source and destination paths. For directories, use cp -r to copy recursively.

Uploaded by

Deepak
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Navigation of Directories Navigation of Directories

To
Tochange
changethe
thedirectory
directory To
Tochange
changedirectory
directoryto
tolast
lastworking
workingdirectory
directory
[root@comp1
[root@comp1 ~]# cd <path of thedirectory>
~]# cd <path of the directory> [root@comp1 ~]# cd –
[root@comp1 ~]# cd –

To
Tochange
changedirectory
directoryto
tohome
homedirectory
directory
To
Tochange
changedirectory
directoryone
onelevel
levelback
back [root@comp1 ~]# cd or
[root@comp1 ~]# cd or
[root@comp1 ~]# cd ..
[root@comp1 ~]# cd .. [root@comp1 ~]#cd
[root@comp1~]# cd ~
~

To
Tochange
changedirectory
directorytwo
twolevels
levelsback
back
[root@comp1
[root@comp1~]#
~]#cdcd../..
../..

Removing a File or Directory Copying a File or Directory

To
Toremove
removeaafile
file
[root@comp1 ~]# rm <filename>
[root@comp1 ~]# rm <filename>
To
Tocopy
copyaafile
file
[root@comp1
[root@comp1 ~]# cp <sourcefile
~]# cp <source filepath>
path><destination
<destinationfile
filepath>
path>

To
Toremove
removeempty
emptydirectory
directory
[root@comp1
[root@comp1 ~]# rmdir <directoryname>
~]# rmdir <directory name>

To
Tocopy
copyaadirectory
directory
[root@comp1
[root@comp1~]#
~]#cp
cp –r
–r <source
<sourcedir
dirpath>
path> <destination
<destinationdir
dirpath>
path>

To
Toremove
removedirectory
directoryrecursively
recursivelyand
andforcefully
forcefully
[root@comp1
[root@comp1~]#
~]#rm
rm –rf
–rf <directory
<directoryname>
name>

You might also like