The first order of business in manipulating a file is viewing the current directory, then navigating to the directory that contains the file be changed.

The following command will display the current directory:


By default, the first directory that users find themselves, is their home directory. This is in the home directory, in a users subfolder.

This is displayed as:


Common folders that can be found in a home directory are:


To return to the home folder, execute the following command:


To change directories from the home folder to the Documents folder, issue the following command:

cd /home/username/Documents

A shortcut that always refers to the users home directory (/home/username) is:


This shortcut would be executed as:

cd ~/Documents

In addition to a home directory, there is also root directory. This root directory is where all of the files for the operation of the operating system and program files are maintained. Some of the folders are available to the user for changes and others are not. These folders are listed below.

This is the root directory:

cd /

This is the device folder that lists all of the devices like hard drives and USB ports:

cd /dev

The etc folder lists the configuration files for many of the software packages:

cd /etc

The var folder holds many of the system logs as well as html files for web pages.

cd /var

The tmp folder is available to the user as a temporary storage location:

cd /tmp

The media folder is a location that external storage devices are mounted to.

cd /media

The srv folder is usually an empty directory that is reserved for functions of some servers:

cd /srv

It is important to note that capitalization is extremely important in Linux. For instance the ~/Documents folder is a completely different folder than the ~/documents folder (in all lowercase).

As a rule, try to keep all file names and folder names in all lower case.

Also, Linux does not work well with spaces in file names and folder names. Avoid spaces at all costs. File naming techniques include:


There are a number of commands that are used to manipulate files. In Linux, users will continually be making changes to configuration files. It is highly recommended that prior to making changes to any configuration file, that a copy be made of the original configuration file. This ensures that there is an original baseline file to go back to if changes to the original are found to be not working-the copy allows you to return to the original state. In Linux, the suffix i.e. .txt or .exe have no meaning to the Linux Operating System, in most cases. (Where in Windows OS, these extensions do have meaning.) It is common practice to append a file with _orig or .orig in order to delineate the file as a copy of the original.

Then command to execute a copy of a file is:

sudo cp filename filename_orig

Text editing.

Nano is a text editing program similar to Windows Notepad. This program is used to edit configuration files.

To view the file content use the command:

nano /location/filename

To edit the file content, use the command:

sudo nano /location/filename

More can be found on text editing Here.

Make a new directory.

To make a new folder or directory use the command:

sudo mkdir directory_name

Make a new file. To make a new file that has no content, use the command:

sudo touch

Move or rename a file.

Sometimes a file may need to be moved or renamed. To move or rename a file:

sudo mv /etc/old_file /new_location/new_filename

File ownership.

Each file has an owner. By default most files are owned by the user: root. The owner of a file can be changed to any user that has already been created. The command to change the owner of a file is:

sudo chown user filename

To change the group that has ownership of the file, use the command:

sudo chown user:group filename

File permissions.

Each file has a set of permissions that allow only certain users or all users access. Permissions are best administered in three sections:

1. Owner Permissions
2. Group Permissions
3. Anonymous Permissions

Each of these three sections have 7 levels of permissions. These levels of permissions are:

0 no access
1 Execute only
2 Write only
3 Execute + Write
4 Read only
5 Read + Execute
6 Read + Write
7 Read + Write + Execute

Permissions are granted in a three digit number to each file. The permissions are issued to the owner with the first digit, then to the group with the second digit, then to the anonymous user with the third digit.

For instance, the permission group: 700 would give read + write + execute access to only the owner. Any group or anonymous users would have no access.

A permission level of 754 would give read + write + execute access to the owner, read + execute privileges to the group and read only to the anonymous user.

The command to assign permissions to files is:

sudo chmod ### filename

Downloading files from the Internet.

Downloading files from the command line is a valuable tool. This is commonly used to download files to be executed. This can also be used to grap web pages to be modified.

After navigating to the directory in which to download the file, the command to download the program: Putty would look like this:


Next: Connect to a Network