The most frequent tasks that you perform on your PC is creating, moving or deleting Files. Let's look at various options for File Management.
To manage your files, you can either use
In this tutorial, you will learn-
Both GUI and CLI have their specific uses. For example, in GUI, performance monitoring graphs give instant visual feedback on system health, while seeing hundreds of lines of logs in CLI is an eyesore.
You must learn to use both GUI(File Manager) and CLI (Terminal)
GUI of a Linux based OS is similar to any other OS. Hence, we will focus on CLI and learn some useful commands.
There are 2 ways to launch the terminal.
1) Go to the Dash and type terminal
2) Or you can press CTRL + Alt + T to launch the Terminal
Once you launch the CLI (Terminal), you would find something as gtupapers@VirtualBox(see image) written on it.
1) The first part of this line is the name of the user (bob, tom, ubuntu, home...)
2) The second part is the computer name or the host name. The hostname helps identify a computer over the network. In a server environment, host-name becomes important.
3) The ':' is a simple separator
4) The tilde '~' sign shows that the user in working in the home directory. If you change the directory, this sign will vanish.
In the above illustration, we have moved from the /home directory to /bin using the 'cd' command. The ~ sign does not display while working in /bin directory. It appears while moving back to the home directory.
5) The '$' sign suggests that you are working as a regular user in Linux. While working as a root user, '#' is displayed.
The directory that you are currently browsing is called the Present working directory. You log on to the home directory when you boot your PC. If you want to determine the directory you are presently working on, use the command -
pwd
pwd command stands for print working directory
Above figure shows that /home/gtupapers is the directory we are currently working on.
If you want to change your current directory use the 'cd' command.
cd /tem
Consider the following example.
Here, we moved from directory /tmp to /bin to /usr and then back to /tmp.
If you want to navigate to the home directory, then type cd.
cd
You can also use the cd ~ command.
cd ~
The root of the file system in Linux is denoted by '/'. Similar to 'c:\' in Windows.
Note: In Windows, you use backward slash "\" while in UNIX/Linux, forward slash is used "/"
Type 'cd /' to move to the root directory.
cd /
TIP: Do not forget space between cd and /. Otherwise, you will get an error.
You can navigate through multiple directories at the same time by specifying its complete path.
Example: If you want to move the /cpu directory under /dev, we do not need to break this operation in two parts.
Instead, we can type '/dev/cpu' to reach the directory directly.
cd /dev/cpu
For navigating up one directory level, try.
cd ..
Here by using the 'cd ..' command, we have moved up one directory from '/dev/cpu' to '/dev'.
Then by again using the same command, we have jumped from '/dev' to '/' root directory.
A path in computing is the address of a file or folder.
Example - In Windows
C:\documentsandsettings\user\downloadsIn Linux
/home/user/downloads
There are two kinds of paths:
Let's say you have to browse the images stored in the Pictures directory of the home folder 'gtupapers'.
The absolute file path of Pictures directory /home/gtupapers/Pictures
To navigate to this directory, you can use the command.
cd /home/gtupapers/Pictures
This is called absolute path as you are specifying the full path to reach the file.
The Relative path comes in handy when you have to browse another subdirectory within a given directory.
It saves you from the effort to type complete paths all the time.
Suppose you are currently in your Home directory. You want to navigate to the Downloads directory.
You do no need to type the absolute path
cd /home/gtupapers/Downloads
Instead, you can simply type 'cd Downloads' and you would navigate to the Downloads directory as you are already present within the '/home/gtupapers' directory.
cd Downloads
This way you do not have to specify the complete path to reach a specific location within the same directory in the file system.
Summary:
Command | Description |
|---|---|
cd or cd ~ | Navigate to HOME directory |
cd .. | Move one level up |
cd | To change to a particular directory |
cd / | Move to the root directory |