What are some useful commands to navigate and manage the directory structure in Ubuntu Linux 18.04 LTS?

Here are some commands to help you get started navigating and managing directories with Ubuntu Linux 18.04 LTS:

pwd (print working directory) - Displays your current location in the filesystem directory structure.

ls - Lists the contents of the current directory. Add the -alt argument to see detailed information about each file or sub-directory contained in the current directory. Add the -a argument to list all files and directories without details.

cd - Changes directories. To navigate to a sub-directory of the current directory, type cd followed by the entire path to the sub-directory. The cd command is case-sensitive.

For example, if the working directory is currently /home, the following command changes the working directory to the /home/Ubuntu/Documents directory:

cd Ubuntu/Documents

To change the working directory to the directory one level above the current directory, use the following command:

cd .. 

mkdir - Creates a new directory. For example, the following command creates a directory named spreadsheet as a sub-directory of the current directory:

mkdir spreadsheet

mv - Moves or renames files or directories. For example, the following command changes the name of the directory spreadsheet to spreadsheets:

mv spreadsheet spreadsheets

The following command moves the file test from the current directory to the /Documents/spreadsheets directory:

mv test /Documents/spreadsheets

rmdir - Removes empty directories. For example, if the spreadsheets directory is empty, run the following command to remove it:

rmdir Documents/spreadsheets

rm - Removes files and directories.

For example, the following command removes the Documents/spreadsheets directory and any files or sub-directories in the spreadsheets directory:

rm –r Documents/spreadsheets

To learn more about a command, use one of the following additional commands or arguments.

The info command displays general information about a command:

info (cmd)

The man (manual) command displays more detailed information about a command:

man (cmd)

Add the --help argument to display the available arguments for a command:

(cmd) --help

To see the manual files for Ubuntu 18.04 in HTML format, see Ubuntu Manuals – 18.04 LTS.


Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.

Published: 2014-12-31

Updated: 2018-04-13