Friday 6 November 2015

UNIX TUTORIAL-Navigation in Unix





Hi everyone 
In this post we will learn how to navigate in the unix file system using the terminal.Here i will be using os x for this purpose and don't worry if you are using linux or any other unix based os because the technique is the same everywhere.



Before moving on i wold like to clarify your thoughts between files and folders.Folders the locations or the directory which stores information in the form of files but files are the objects which store informations in different formats  for example .mp3,.pdfs,.zip etc.

Now take a look on the files present in the picture which is present in the user directory of the computer named abhilashnaik.As you can see the user directory contains files named apps,Desktop,Documents,Movies,Music,Pictures,Public and VirtualBoxVMs.


And i know that i am now present in directory named abhilashnaik which is the users directory.Whenever we login to any computer we are always present in the directory of the user with respective name that has logged in .But still if you want to know the location then you can use the pwd command to check .Open up the terminal and type pwd.


Now i am present inside abhilashnaik which is the sub directory of users .
We can use the command ls which lists all the files and folders present in a directory as shown in the following gif.



Now if want to move into music directory what i will do is type cd means change directory and type the name of the directory,unix is a case sensitive system so be careful.

Now i am in the music directory to check the list of stuffs present inside it i can type ls and check.







But how to change directories when it comes to a directory with special character or space in it .It very simple all you have to do is escape the space or character or number after space using \ " " or ' ' for example i have a directory named A State of Trance 2015 in the music folder if i have to go inside it i wold type in the following ways.

cd A\ State\ of\Trance\ 2015\
cd "A State of Trance 2015" or cd 'A State of Trance 2015'

cd A" " State"  "of" "Trance" "2015 or cd A' 'State' 'of' 'Trance' '2015

and if you have to go back to the parent directory i have to type cd ~ and you can type cd ../ if you want to go back one directory, cd ../../ for going back two directories and so on remember ../ means one directory back you have to add ../ as per your requirement for example i f have to go 7 directories back i have to type cd ../../../../../../../../ Or you can go back directly to the parent directory using cd ~.

for going back one or more directories using ../

for going back to parent directory using cd ~







No comments:

Post a Comment

Bottom Navi

copyright Encyberpedia. Powered by Blogger.

Followers