Linux File System Navigation and Finding Files
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 dir…
No comments yet. Add the first comment to start the discussion.