Linux Shell Commands - Part 3
In This Post, I will Show Directory Traversal and How To Create Folders.
Computer Korner |
To Traverse through directory, 'cd' command is used
When you start the Konsole Or Terminal You are in the Home Directory.
To Move into a sub directory or directory 'cd <dir name>', 'pwd' reveals the current directory path
root@bt:~# cd Desktop/
root@bt:~/Desktop# pwd
/root/Desktop
root@bt:~/Desktop# cd Ckorner/
root@bt:~/Desktop/Ckorner# pwd
/root/Desktop/Ckorner
To go back one directory, 'cd ..' (cdspacedotdot)
root@bt:~/Desktop/Ckorner# cd ..
root@bt:~/Desktop# pwd
/root/Desktop
To go back two directory, 'cd ../..' (cdspacedotdotslashdotdot)
root@bt:~/Desktop/Ckorner# cd ../..
root@bt:~# pwd
/root
'cd' with no option, returns to the HOME directory regardless of wherever you are in the directory path.
root@bt:~# cd Desktop/Ckorner/
root@bt:~/Desktop/Ckorner# pwd
/root/Desktop/Ckorner
root@bt:~/Desktop/Ckorner# cd
root@bt:~# pwd
/root
root@bt:~#
Same as the previous, 'cd ~' , returns to the HOME directory regardless of wherever you are in the directory path.
root@bt:~/Desktop/Ckorner# pwd
/root/Desktop/Ckorner
root@bt:~/Desktop/Ckorner# cd ~
root@bt:~# pwd
/root
root@bt:~#
'cd /' changes to root directory.
root@bt:~# cd Desktop/Ckorner/
root@bt:~/Desktop/Ckorner# pwd
/root/Desktop/Ckorner
root@bt:~/Desktop/Ckorner# cd /
root@bt:/# pwd
/
root@bt:/#
Next, I will show how to make a Folder., command used is 'mkdir <foldername>', to make hidden folder, 'mkdir .<name>'
root@bt:~/Desktop/Ckorner# mkdir post3
root@bt:~/Desktop/Ckorner# cd post3/
root@bt:~/Desktop/Ckorner/post3# mkdir AnotherFolder
root@bt:~/Desktop/Ckorner/post3# mkdir .hiddenFolder
root@bt:~/Desktop/Ckorner/post3# ls -l
total 4
drwxr-xr-x 2 root root 4096 2012-07-08 14:50 AnotherFolder
root@bt:~/Desktop/Ckorner/post3# ls -la
total 16
drwxr-xr-x 4 root root 4096 2012-07-08 14:50 .
drwxr-xr-x 5 root root 4096 2012-07-08 14:50 ..
drwxr-xr-x 2 root root 4096 2012-07-08 14:50 AnotherFolder
drwxr-xr-x 2 root root 4096 2012-07-08 14:50 .hiddenFolder
root@bt:~/Desktop/Ckorner/post3# cd AnotherFolder/
root@bt:~/Desktop/Ckorner/post3/AnotherFolder# ls
root@bt:~/Desktop/Ckorner/post3/AnotherFolder# cd ..
root@bt:~/Desktop/Ckorner/post3# cd .hiddenFolder/
root@bt:~/Desktop/Ckorner/post3/.hiddenFolder# pwd
/root/Desktop/Ckorner/post3/.hiddenFolder
root@bt:~/Desktop/Ckorner/post3/.hiddenFolder# cd ~
root@bt:~#
'ls' command is used to check the files/folders and sub-folders in a Directory
More About 'ls' in later posts. Thats All For this post.
Feel Free To Leave A Comment If Our Article has Helped You, Support Us By Making A Small Contribution, Thank You!
Ahaa, its fastidious discussion concerning this article
ReplyDeleteat this place at this blog, I have read all that, so now me also commenting at this place.
Also visit my webpage :: cool article topics
Wonderful beat ! I wish to apprentice while you amend your web site, how can
ReplyDeletei subscribe for a blog site? The account aided me a acceptable deal.
I had been a little bit acquainted of this your broadcast provided bright clear idea
My web blog Asics Gel-Kayano 17
Unquestionably сonsider that which you said. Yοur faѵοrite
ReplyDeletereasоn seemed tο be on the internеt the еasiest
thing to undеrstand of. ӏ saу to you, Ӏ certainly gеt annoyed ωhile folks
think abοut ωorriеs that they ϳust don't realize about. You managed to hit the nail upon the top and also defined out the entire thing without having side effect , folks can take a signal. Will likely be back to get more. Thank you
My web page ... cenaslim funciona