Professional Documents
Culture Documents
File Management
Managing your files and directories in the command line can seem intimidating, but once you master a few
basic commands, you'll be able to navigate and manipulate your files with ease. In this module, we'll cover file
and directory manipulation, permissions, piping and redirection, and absolute and relative paths.
Navigation and File Management
Navigating File Listing Creating Directories
Directories
To list all files and subdirectories To create a new directory, use
To navigate between in your current directory, use the mkdir command followed
directories, use the cd the ls command. Add the -l flag by the desired directory name.
command, followed by the to get a detailed listing with file
directory path. Use cd .. to permissions, owners, and more.
move up one directory.
File and Directory Manipulation
Command Description
Piping and redirection are powerful features that allow you to combine and manipulate commands in a
variety of useful ways. Piping takes the output of one command and sends it as input to another
command. Redirection allows you to redirect input and output to and from files.
Combining Piping and Redirection
The possibilities for combining piping and redirection are nearly endless. For example, you can use piping to
sort a list of files and redirection to save the output to a file.
Absolute and Relative Paths
1 2
An absolute path refers to the full path of a file A relative path refers to the path of a file or
or directory, starting from the root directory. For directory relative to the current working
example, /home/user/file.txt is an absolute directory. For example, if you're currently in the
path. /home/user directory, the relative path to
file.txt in the /home/user/docs directory would
be docs/file.txt.
The Power of the Command Line
Efficiency Automation Flexibility
Once you learn the basic You can use the command The command line gives you
commands, the command line to automate repetitive more control and flexibility
line can be much faster and tasks, such as renaming files over your files and directories
more efficient than using a or resizing images. than most GUIs.
GUI to manage your files.