By Graham K. Rogers
Ever since the first Macs appeared, they have been known for the graphical user interface (GUI): icons instead of command line work which before the mid-1980s was the norm. Paradoxically, the arrival of OS X brought with it easy access to the command line should users ever want this, although it is possible to use the computer without ever needing to work at the command line at all.
Navigation in Terminal is fairly important: how to move around the folders (directories). With the normal list in the Home folder, typing the command cd then entering the exact name of the folder -- names are case-specific -- will move down one level.
For example, if the Home folder shows a list (ls) of contents something like
Desktop | Downloads | Library | Music | Public |
Documents | Dropbox | Movies | Pictures | Sites |
Then using the command
cd Desktop
will change the directory and the information displayed for the command line will change to
Office-iMac:Desktop Graham$
[computer name: folder account_name command line symbol ($)]
To move back up one folder (in this case to the Home folder), type in the command followed by a space and 2 dots.
cd ..
To move to the very top level, called Root, we would type
cd /
To see the folders in the Root level, again we can use the cd commands (e.g. cd or cd -ls). The display shows folders that we can see on the Mac as well as a number of folders that the system uses for its operations.
Beware - Root is dangerous especially if working in the Admin account.
Navigating up and down directory structures is sometimes complex. We can drag a location from the finder. For example, if I am working in Root and I want to return to the Home folder of my User account, I can type in the cd command, then using the Finder drag the house symbol to the Terminal window. The "path" -- the way down to the folder -- will be entered automatically.
That will apply for any file or folder location.
To be continued. . . .
See Also -
New Users and Terminal (1) -- A Quick Look Round
New Users and Terminal (3) -- Shell Basics
New Users and Terminal (4) -- Lists and Manuals
New Users and Terminal (5) -- Internet Use
New Users and Terminal (6) -- Questions of Identity
New Users and Terminal (7) -- A Little More Discovery
New Users and Terminal (8) -- File Commands and More
New Users and Terminal (9) -- Process Identification and Termination
New Users and Terminal (10) -- Browsing the Web using Unix
New Users and Terminal (11) -- Unix Tricks from OS X Daily
New Users and Terminal (12) -- Installed Text Editors - emacs, nano, pico, vi and vim
New Users and Terminal (13) -- Installing and Using the Utility, WGET
New Users and Terminal (14) -- Passwords, Purging and Closing Notes
New Users and Terminal (15) -- Permissions and chmod
Graham K. Rogers teaches at the Faculty of Engineering, Mahidol University in Thailand. He wrote in the Bangkok Post, Database supplement on IT subjects. For the last seven years of Database he wrote a column on Apple and Macs.
|