Cisco Logo

Basic Linux Commands: Moving Around Directories

by Elena Mofar, Published on May 19, 2023

Before anything else, we need to be proficient in moving around different directories using CLI.


First off, please open the Linux terminal – click Activities >Terminal


Since we will be using mostly CLI in the entire course, we need to have a sense of location everytime – meaning, we need to know where we are in the directory structure and be able to change directories efficiently.


Unlike in Windows where we can have an overview on where we are just by looking at the address tab or in the File Explorer GUI:

We don’t have that luxury when using the CLI.


But, there is a command that can tell us specifically where we are in the directory tree – the pwd command.

pwd (present working directory)

This command gives us the absolute path on where we are currently:

Linux pwd command output

Take note that everytime we open the terminal, it takes us by default to the home directory of the current user that we are logged in to.


From the above example, I am logged in as the root user so the terminal took me to the /root directory , the home directory of the root user.


If I try to login again this time by using user1’s account, and issuing the pwd command :

cd (change directory) command

This command enables us to change directory locations

The point of using dummy text for your paragraph is that it has a more-or-less normal distribution of letters. making it look like readable English.

ls (list) command

This command lists down all files and directories

There are 2 ways to use the ls command:

  1. Just issuing the ls command
  2. Using the ls <absolute path of directory) command

1.Just issuing the ls command

2.Using the ls <absolute path of directory> command

We can list down all files and directories of a remote directory by specifying its absolute path:

The ls command has different options that we can use:

OPTIONS:

-a , --all

lists all files and directories including hidden files, the current directory link ( denoted by the single dot [.] ) , and the parent directory link (denoted by double dots [. .] )

-l (long list)

lists all file and directory details including permissions, size, ownership, and date modified

-h, --human readable

when used together with the -l option, prints sizes of the files in human readable format

Next Topic Suggestion:

How to Install Python 3 on your Windows Computer

Category Suggestion

Recent Posts

Para sa Fresh Graduates, Trabaho Ba Agad? O Aral Ulit?
Basic Python : The print( ) Function
How to Install Python 3 on your Windows Computer
Basic Linux Commands: Moving Around Directories
Linux Command Syntax