Navigating the Terminal in Ubuntu

|

Learning to navigate the terminal is the first step in mastering the power of Bash. After all, you have to know where you are going and how to get there. Let’s start by creating a launcher for the terminal since we will be using it so often in this chapter. To begin, select Applications | Accessories. Normally, you would select Terminal here, but this time right-click Terminal and select Add This Launcher To Desktop. This will create a shortcut icon on the desktop that you can use whenever you need the terminal.

Now whenever you want to do some work in the shell, you can double-click the Terminal Launcher and you are ready to go.

When you first open the terminal, you will see something like jeff@jeff-desktop:~$. This means the user named jeff is logged into the computer named jeff-desktop. Now you are going to enter your first command, which will show you the path of the current directory. At the prompt, type in the letters pwd (print working directory). The pwd command is useful because it will let you know exactly where you are in the file system. Now that you have entered your pwd command, press ENTER, and you should see the following output:

jeff@jeff-desktop:~$ pwd
/home/jeff
jeff@jeff-desktop:~$

Let’s take a look at what files and folders are in the /home/jeff directory. At the command, type ls and then press ENTER. The ls command will list all of the files and folders in the current working directory.

If you want to see files in a folder other than the current working directory, you can use the ls command to do that as well. For instance, if you wanted to see what was in the Pictures folder, you could type

ls /home/jeff/Pictures
Or, you can use a shortcut to access this by typing ./ as a substitute for /home/jeff:

ls ./Pictures

Now you may want to get into the Pictures directory to do some work. You know what files and folders are in this directory from the ls command, but if you were to type “pwd” again, you would see that you are still in the /home/jeff directory and not in /home/jeff/Pictures, where you want to be. This is where the cd (change directory) command comes into play. For example, if you want to go into the Pictures directory, you would type

cd Pictures

at the prompt. Once you press ENTER, your prompt will change as well to resemble

jeff@jeff-desktop:~/Pictures$

If you want to go back to the home folder, simply type cd again and press ENTER.

Now you’ve played around a bit in your own backyard, so it’s time to take a trip outside of the home folder and into the rest of the Ubuntu file system. Remember the commands you have just learned, and you can find your way back home.

Remember—when you are in the terminal, everything is case sensitive. If you were to type ls ./pictures, you would receive a message telling you that there is “No such file or directory.” On the other hand, ls ./Pictures provides the names of the files and folders under Pictures. When you are typing filenames and folder names, you can use a little shortcut to speed through this. After you have typed the first few letters of either a folder or filename that already exists, press TAB and the rest of the name will be completed for you.

Source of Information : McGraw Hill Osborne Media How to Do Everything Ubuntu

0 comments:

Subscribe to Computing Tech

Enter your email address:

Delivered by FeedBurner

Add to Technorati Favorites Top Blogs