Nanohost logo
PricingFAQ
Log inSign Up

Linux Navigation and File Management

Tutorials

5 Sept 2025

By

Alex Rich

Nanohost Team

Linux Navigation and File Management full

Learning how to move around and manage files and folders in the Linux filesystem is one of the most important skills for working with any computer. On cloud servers, these tasks are usually done through the terminal using well-known Linux shells and standard commands. This guide will walk you through some of the essential skills needed to work with files and directories from the terminal.

Prerequisites and Goals

To follow along with this tutorial, you’ll need access to a Linux server. If you’re not sure how to connect for the first time, check out our guide on connecting to a Linux server with SSH.

You should also be familiar with what the terminal is and what Linux commands look like. This guide assumes you’re using a normal, non-root user account (not an administrator).

When you’re ready, log into your server using SSH to continue.

Navigation and Exploration

The first set of skills you need to practice is learning how to move around the filesystem and inspect what’s available in different locations.

Finding Your Location with pwd

When you log into your server, you are usually placed inside your user’s home directory. This directory is reserved for your files and subdirectories, and you have full control over it.

To see your exact location in the filesystem, use the pwd command:

pwd

Output:

/home/sammy

Here, the home directory belongs to the user sammy. It lives inside the /home directory, which is itself located at the root /.

Listing Directory Contents with ls

Once you know where you are, you can view the contents of a directory with the ls command.

First, move into a populated directory:

cd /usr/share
pwd

Output:

/usr/share

Now, list its contents:

ls

Output (partial):

adduser     grub      perl5
apport      icons     polkit-1
apt         i18n      pkgconfig

To display extra details, such as permissions, ownership, size, and modification time, use the -l flag:

ls -l

Output (partial):

drwxr-xr-x   2 root root  4096 Apr 17  2022 adduser
drwxr-xr-x   6 root root  4096 Oct  9 18:16 apport

To include hidden files (those starting with .), use -a. Try this in your home directory:

cd
ls -a

Output:

.  ..  .bashrc  .profile

Here, . means the current directory and .. means the parent directory.

Moving Between Directories with cd

You can switch directories by using either absolute paths (starting with /) or relative paths (based on your current location).

Example of absolute path:

cd /usr/share

Example of relative path:

cd locale
cd en/LC_MESSAGES

To move back up one level:

cd ..

To quickly return to your home directory:

cd ~

Viewing Files

Linux relies heavily on plain text files for system configuration. One of the best tools to view files is less, which allows scrolling and searching.

less /etc/services

Use /word to search, n to jump to the next match, N for the previous match, and q to quit.

Other useful commands:

  • cat file → print entire file
  • head file → show first 10 lines
  • tail file → show last 10 lines

File and Directory Manipulation

Creating Files with touch

cd
touch file1
ls

You can also create multiple files at once:

touch /home/sammy/file2 /home/sammy/file3

Creating Directories with mkdir

mkdir test
mkdir test/example
mkdir -p some/other/directories

The -p option creates all necessary parent directories.

Moving and Renaming with mv

Move a file:

mv file1 test

Rename a directory:

mv test testing

⚠️ Be careful — if the destination already exists, it will be overwritten.

Copying with cp

Copy a file:

cp file3 file4

Copy directories recursively:

cp -r some again

Deleting with rm and rmdir

Delete a file:

rm file4

Delete an empty directory:

rmdir testing/example

Delete a non-empty directory:

rm -r again

⚠️ Use caution — deletions are permanent.

Editing Files

The simplest text editor for beginners is nano.

nano file1

Inside nano:

  • Ctrl+O → save
  • Ctrl+X → exit
  • Ctrl+G → help

After saving, you can view your file:

less file1

To exit less output, use q

Other editors like vim or vi are more advanced but harder for beginners. If a guide suggests vim, you can safely use nano instead.

Conclusion

You’ve now learned how to:

  • Navigate the filesystem with pwd, ls, and cd
  • View files with less, cat, head, and tail
  • Create, copy, move, and delete files and directories
  • Edit text files with nano

With these essential skills, you’re ready to explore your Linux system further. In the next guide, we’ll cover Linux file permissions and how to manage them.

linuxtutorialshow-tobasicsubuntu

Read also

How to Reboot Linux Now (Safely): systemctl reboot, shutdown -r now, and Force-Reboot Options

How to Reboot Linux Now (Safely): systemctl reboot, shutdown -r now, and Force-Reboot Options

Tutorials

Whether you’re applying kernel updates, clearing a stuck device, or finishing a configuration change, a reboot is sometimes the cleanest fix. This guide shows beginner-friendly and safe ways to restart Linux immediately (“reboot now Linux”), plus how to force reboot if the system is unresponsive. We’ll cover desktops, servers, and remote machines over SSH.

Linux Navigation and File Management

Linux Navigation and File Management

Tutorials

Learning how to move around and manage files and folders in the Linux filesystem is one of the most important skills for working with any computer. On cloud servers, these tasks are usually done through the terminal using well-known Linux shells and standard commands. This guide will walk you through some of the essential skills needed to work with files and directories from the terminal.

Linux Essentials: Step-by-Step Guides

Linux Essentials: Step-by-Step Guides

Tutorials

Learn the basics of the Linux terminal — what it is, how the shell and command prompt work, and how to run your first commands.

Products

Server in the United StatesServer in the United KingdomServer in NetherlandsServer in SingaporeServer in Poland

NOVPS CLOUD LTD ©2025