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.
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
Navigating the File System
pwd (Print Working Directory)
pwd command displays the full path of your current working directory. It helps you identify your current location in the file system.
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.
ll command (or
ls -l) provides a detailed listing that includes file permissions, ownership, file size, and modification dates.
cd (Change Directory)
cd command is used to change your current working directory. You can navigate to a specific directory by providing its path as an argument.
find (Find Files and Directories)
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.
mkdir (Make Directory)
mkdir command is used to create new directories (folders) in the file system. You provide the directory name as an argument.
rmdir (Remove Directory)
rmdir command is used to remove empty directories from the file system.
Checking Disk Usage
df (Disk Free)
df command displays information about disk space usage on your system, including the capacity, used space, and available space for mounted filesystems.
du (Disk Usage)
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.