Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Basic Linux File and Directory Commands

For this article I'm using Linux Ubuntu 12.04 LTS, but I doubt that it makes much difference which version of Linux you use. To enter commands, you'll have to put Linux in command line mode. Linux may be configured to boot to the CLI (Command Line Interface) or the GUI (Graphical User Interface).

If it's configured to boot to the GUI, you can enter command line mode by pressing [Ctrl]+[Alt]+[F1]. Once in the command mode you'll need to enter your username and password before you can enter any commands.

Note Linux doesn't display any feed back, like dots or stars as you enter your password.

In command mode you'll be provided with the command prompt, an example is shown below.


Your command prompt will be different than the one shown above. The command prompt consists of your user user name, an @ symbol, and your system's name, a colon (:) symbol, a tilde symbol (~) (tilde represents the top level directory), and a dollar symbol ($). You type your command after the $ symbol.

1. The first command you might enter is pwd (present working directory) as shown below.

stephen@stephen-Satellite-M35X:~$ pwd

When you press the [Enter] key, the command line interpreter will respond with your present location in the directory hierarchy. If this is your first command after logging in, you will probably be in your home directory. An example of a home directory path returned by Linux is shown below.


Each time Linux responds with a result, it will also provide a fresh prompt, ready for your next command.

2. To change your current working directory to a directory one level higher enter the command cd .. (change directory). Note that there is a space between the cd and the two dots. as shown below.

stephen@stephen-Satellite-M35X:~$ cd ..

The two dots mean to move up one level to the parent directory. Linux will respond to this command by placing the new current directory location in the command prompt as shown below.


3. To get a list of the directories and files in the new current directory, enter the command ls (list sub-directories) as shown below.

stephen@stephen-Satellite-M35X:/home$ ls

In response to this command, Linux will return the name of the directories contained in the current directory as shown below.


4. To change your current working directory to a sub-directory of the current directory, enter the command cd along with the name of the sub-directory, as shown below.

stephen@stephen-Satellite-M35X:/home$ cd stephen

The sub-directory name that you entered now becomes the current directory.

To determine your location in the directory hierarchy, you can type in the command pwd as often as you need.

5. To get a list of the contents of the current directory, enter the command ls as shown below.

stephen@stephen-Satellite-M35X:~$ ls

In response to this command, Linux will return a list of all the directories and files in the current directory as shown below.

Desktop Documents Downloads examples.desktop
Music Pictures Public Templates Videos

Note that the names of directories are in blue and the names of files are in white.

6. Since I don't have any videos in my home directory, I want to delete the Videos sub-directory. To delete a sub-directory, use the command rmdir (remove directory) followed by the name of the directory to delete as shown below.

stephen@stephen-Satellite-M35X:~$ rmdir Videos

If the directory is not an immediate sub-directory of the current directory, you'll need to type in the full path to the directory.

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2021 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268