File & directory basics
The shell prompt
By default when you log into the server as the `root` user, you are put into the `root` user's home directory: `/root`. On all deepOfix servers, the shell prompt is one of the forms:
root@hostname:current_directory#
eg:
root@deepOfix:~# root@deepOfix:/var/easypush#
OR
root@hostname.domain-name:current-directory#
eg:
root@demo.deeproot.in:~# root@demo.deeproot.in:/var/easypush#
The currrent-directory part of the prompt displays the absolute path of the directory that you are currently in. However, when you are in your home directory, the shell uses a special character `~` (tilde) to represent the current path. So right after you login as the `root` user, you should see the prompt as something like this:
root@deepOfix:~#
You can also use the pwd command to know the current directory you are
in. pwd stand for present working directory.
root@deepOfix:~# pwd <ENTER> /root
All directory paths on GNU/Linux start with a / (forward slash). This is called the root directory (not to be confused with the /root directory which is the home directory of the root user). All directory paths on the operating system are relative to the root directory.
Changing directories
To change your current directory you can use the cd command as shown
below:
root@deepOfix:~# cd /usr/share/doc <ENTER> root@deepOfix:/usr/share/doc#
You can change back to the previous directory by using a special argument to the `cd` command. Running `cd -` will take you to the last directory you were in. For example:
root@deepOfix:~# cd /usr/share/doc <ENTER> root@deepOfix:/usr/share/doc# pwd <ENTER> /usr/share/doc root@deepOfix:/usr/share/doc# cd - <ENTER> root@deepOfix:~# pwd <ENTER> /root
Auto completion
The shell provides you with an auto-complete facility. You can type a part of a file or directory name, press the <TAB> key and the shell will complete it for you. Of course, there should be some file or directory that exists and starts with the part that you've typed.
If the part of the file or directory name that you have typed is unique (ie. there is no other file or directory which starts like that), the shell will complete it for you immediately. If there are multiple files or directories which start with the part you've typed, the shell will show you all possible options. You can then type a few more characters to complete the file or directory path.
This also works for commands - not just for files or directories.