The commandline provides you opportunities which would otherwise be unavailable if you restricted yourself to gui. This makes sense because when designing a command line program then developer is not tied down to creating an extensive user interface for the user and thus can make more features in their program.
As you become better at the command line, you'll start constructing more complex commands to do specific things. Personally my recollection of complex commands usually fades quickly, and so having a method to save these commands becomes important.
To kick things off, lets consider the way most people come up with commands. Usually it goes like this (come up with an idea) -> (figure out a command which can do that). The first part of this process is the easy one, and the latter being harder.
For example lets say we wanted to list the files in the current directory, to someone who already knows about the command
ls this is a breeze, but to a fresh user, they might not know how and get stuck, thus the most important part of using the command line is actually knowing what commands you have available.
If there's one command you have to know, it would
man, to get started run
Now that you know that man describes what a program does through it's manual page, I need to bestow the most important skill when using man: Attention Span.
Being able to stay focused on a man page is what will free you from having to use the internet. The reason why this might be difficult is simply that man pages shove a bunch of information in front of your face which can be quite overwhelming.
Near the bottom of most man pages there is an overview section or at least a section that describes some of the details of the program which is nice to read after reading the intro.
What Do You Have?
Going back to our process of (come up with an idea) -> (figure out a command which can do that), then one easy way that many use is the internet. For example for the fresh user not knowing
ls in the example, they might open up the browser and type in "how to list files in the current directory", and then learn about the
The command line is great because on any unix system you'll have access to it without having to install any dependencies or other software. With that in mind, it would be a little sad if we had to resort to using a whole other gui program with the requirement of an internet connection to actually get anything done at the command line.
The best command to combat internet use in this regard is the
apropos command, use
man apropos to figure out what it does.
When reading the man page for apropos you might see the mention of a regex, which is short for a regular expression, note that if an aspect or topic is second to the main task of the program, it is usually not explained and assumes you understand what it is. This allows command descriptions to stay short and to the point.
Wrangling a Man Page
A very useful skill to have is the ability to search in a man page, and to do that we need to know more about whats even displaying the man page. So let's go back to
man man and use the arrow keys to go to the bottom of the page, eventually once we get to the DEFAULTS section, we can see that: "The formatted manual page is displayed using a pager"
A pager is a program which can display pages of a file the main one used on linux is less
If you find yourself using a command often, it can be useful to create a wrapper around it. For example say we are using ffmpeg to record our screen, you've spent 5 minutes reading the man page to set the perfect options for your framerate and other settings. Now if you want to do this process again, unless you have a great memory you'll have to do this exact process again, which wastes your time.
Additionally command names sometimes are not conducive to memorization, since there is no structured naming format we end up with things like rm to remove files and then rmdir to remove a directory, by wrapping common commands with wrappers we can come up with our own personal naming conventions and hide the implementation. Don't over do it either, things like cd and ls are good because they're short.
Over the years, you may start building up various scripts that do specific tasks that are common to you, keep them organized through named directories and use CDPATH to quickly access them.
Personally I create ~/common_dirs, and then symlink directories in there making sure that common_dirs is part of the cdpath, if you want tab completion I suggest downloading bash-completion
The main command you'll want to use is cd, note that cd directory_name is not it's only usage, at the current moment the only other supported operand is - (so you write cd -) which moves you to the last directory you were in, which is quite useful.
If there is one c
When thrown into a bare shell, you'll want to remember the
You can perform many basic tasks with ffmpeg, make sure you have that installed.
- turn images into a video (also works to turn one image in to a video as well)