This article deals exclusively with the Command Line Interface(CLI), rather than a Graphical User Interface(GUI) you may be familiar with. A basic understanding of the terminal is essential to diagnosing and fixing most Linux based systems.
What is a command? A command is a software program that when executed on the CLI performs an action on the computer. When you type in a command, a process is run by the operating system that can read input, manipulate data and produce output. It runs a process on the operating system, which then causes the computer to perform a job.
List of Commands
The 'ls' Commands
Most commands follow a simple pattern of syntax:
command [options…] [arguments…]
- to display a listing of information about files you will use
ls
Note: Every part of the command is normally case-sensitive, so LS is incorrect and will fail, but ls is correct and will execute.
- results in a "long display" output, meaning the output gives more information about each of the files listed:
ls -l
- To print results in reverse order alphabetical order use:
ls -r
- To sort files by timestamp:
ls -lt
- To sort files by size use:
ls -l -S
Switch Between Directories Commands
- To print the current working directory use:
pwd
- To change from one directory/folder to another use:
cd [directory name here]
- To move to previous directory use:
cd /
- To move to home/first directory use:
cd ~
Find the rest of the article at my blog HERE
Connect With me at Twitter | Insta | YouTube | LinkedIn | GitHub
Top comments (2)
A little correction:
cd /
doesn't move to previous directory, but to the filesystem root (e.g. where the foldersetc
,home
andvar
are located).To move to the previous directory, you can use:
And the home directory doesn't necessary have to be the "first directory" (a session can start outside of the users home directory).
cd ~
always changes directory the current users home (which can, but doesn't have to be the "first directory" after login).Also quite helpful:
To go up one level (e.g. move out of the current folder), you can use:
cd ..
-..
means "the directory above the current one".Still a great overview over the most basic CLI commands on Linux-based operating systems, thank you!
I appreciate for the correction, thank you