Linux File System Navigation and Finding Files
Full-Access Members Only
Sorry, this lesson is only available to Server Academy Full-Access members. Become a Full-Access member now and get instant access to this and many more premium courses. Click the button below and get instant access now.
Instructions
Q&A (0)
Notes (0)
Resources (1)
Saving Progress...
Notes can be saved and accessed anywhere in the course. They also double as bookmarks so you can quickly review important lesson material.
In this lesson, you will learn how to navigate the file system, create folders, and check disk usage on a Linux/Unix system. We will cover essential commands such as pwd
, ls
, cd
, find
, mkdir
, rmdir
, df
, du
, and free
.
Navigating the File System
pwd
(Print Working Directory)
The pwd
command displays the full path of your current working directory. It helps you identify your current location in the file system.
pwd
ls
and ll
(List)
The ls
command is used to list the contents of a directory. By default, it displays the names of files and directories in your current directory.
ls
The ll
command (or ls -l
) provides a detailed listing that includes file permissions, ownership, file size, and modification dates.
ll
cd
(Change Directory)
The cd
command is used to change your current working directory. You can navigate to a specific directory by providing its path as an argument.
cd /path/to/directory
find
(Find Files and Directories)
The find
command is used to search for files and directories within a specified location. You can search based on various criteria such as name, type, and modification time.
find /path/to/search -name "filename"
If your search is returning a ton of permission denied errors, it's because your search includes files or directories for which you do not have permissions. Sometimes, this can cause an issue because the file is located, but it is lost in the output because of all the surrounding permission denied errors. To fix this, you can hide the permission denied errors by redirecting your error output to /dev/null:
find / -name "important.conf" 2>/dev/null
You can learn more about output redirection here.
Creating Folders
mkdir
(Make Directory)
The mkdir
command is used to create new directories (folders) in the file system. You provide the directory name as an argument.
mkdir new_directory
rmdir
(Remove Directory)
The rmdir
command is used to remove empty directories from the file system.
rmdir empty_directory
Checking Disk Usage
df
(Disk Free)
The df
command displays information about disk space usage on your system, including the capacity, used space, and available space for mounted filesystems.
df -h
du
(Disk Usage)
The du
command is used to estimate file and directory space usage. It provides a summary of disk space consumption for a specific location.
du -sh /path/to/directory
This is all we need to cover in this lesson. See you in the next one!
Server Academy Members Only
Sorry, this lesson is only available to Server Academy Full Access members. Become a Full-Access Member now and you’ll get instant access to all of our courses.