Skip to main content

Exploring the File System

Exploring The File System

Linux organizes everything into files and directories. By the end of this section you will be able to navigate directories and create or delete both directories and files.

How To Navigate In Linux

Connect to your Omega and open a terminal.

pwd

Use pwd (print working directory) to display your current location:

pwd

pwd output

If pwd prints /, you are at the root of the filesystem. Any other path indicates a subdirectory.

ls

The ls command lists the contents of the current directory. Run it to see what lives in /:

ls

ls output

Depending on your terminal, files may be color-coded (blue for directories, green for executables, etc.). Use ls -l for a detailed listing that shows permissions and ownership.

cd

The cd command changes directories. Supply a path to move to a new location:

cd /usr/bin

Confirm the change with pwd. A few helpful variations:

CommandDescription
cdReturn to the root directory.
cd ..Move up one directory level.
cd .Stay in the current directory.
cd -Jump back to the previous directory.

How To Create/Delete Files And Directories

mkdir

Create directories with mkdir followed by the name or path:

mkdir NewDirectory
mkdir newdirectoryname1 newdirectoryname2 newdirectoryname3
mkdir /tmp/usr/NewDirectory

mkdir output

rmdir

Remove empty directories with rmdir:

rmdir DirectoryName
rmdir path/directoryname

rmdir output

touch

Create empty files with touch:

touch newFileName
touch path/newFileName

touch output

cat

Use cat to create a file and immediately add content:

cat newfile

After typing your content, press Ctrl+D to save. cat also prints file contents:

cat filename
cat path/filename

cat output

rm

Delete files with rm:

rm filename
rm path/filename

rm output

You now have the basics for navigating the Omega filesystem. Continue with the Redirection guide to learn how to pipe data between commands.