It is normal for the Linux newbies to struggle as they use the system as it is very different from Windows. You might find yourself confused to handle even the simplest of tasks. Though the command line will actually make the Linux life easier, it could be exasperating for the beginners.
You just need to take a few simple tricks that will make you comfortable with the Linux device. In just a few days, you might end up preferring this useful command line. The learning curve is not too hard as you imagine.
If you are new to the command line, you need to get used with the terminal before you actually continue. Read below to know how you can use Linux without much struggle.
Find the right command
A new terminal is a vast ocean of possibilities. You can do much with it and that is why it is terrifying. With many commands that are available for access, choosing the right one is the skill you need to master.
The apropos command will help you find out the commands that lead to the actions that you need to perform. For instance, apropos "description" will give the list of commands that match the description string along with the command's help string.
Execute an Earlier Command
Any person who uses Linux for a long time will resort to the command line to do the troubleshooting. In that state, you might find yourself typing and retyping the same commands for many times. The newbies hit the Up key to get around this. It will cycle through the pass commands that you have typed.
Instead, use the history command that will actually list all the commands that you ever since the specific terminal was launched. It will also identify a number beside each command. You can repeat a previous command by typing !# in which # is the number that is listed next to the command that you want to repeat. Likewise, !! will repeat the last entered command.
Run commands at a particular time
If you want to run a command, but not at that very moment, you can schedule the same for a given time. For instance, you can schedule a command by typing 'at 8:30 AM 03/24/16'. You can type Ctrl + D to leave the input prompt.
Easy task management
There are many task managers in Windows that offer graphical ways to handle the open applications and running processes. Though Linux does not have something as such, you can achieve similar task management with the 'htop' command. You can key in, 'sudo apt-get install htop' on your Ubuntu system.
Once 'htop' is installed, you can type the same on the command line. It will give a full overview of the processes that are running along with the information such as CPU and RAM usage, process IDs, and how long they have been running.
You can scroll through the details by tapping the cursor keys left and right. Also, you can scroll through the other processes that are listed by going up and down. There is an option to get color-coded text that will make it simpler to read what you need at a glance.
Simple Filesystem Navigation
The 'ranger' is another most useful command that does not come as a default app on the Linux distros. However, it is simple to install. You can get it by typing 'sudo apt=get install ranger'.
This command will transform the terminal into an interface to make the navigation across the entire filesystem easy with the keyboard or mouse. Each column is a directory and you can use the left key to move up by one directory and right to enter a directory.
Update the software with PPAs
The software on Ubuntu is managed by a package manager. It maintains a list of repositories that are the source locations for the package downloads. Each Linux distro has a set of repositories.
If you install any application that is not in the core repository, you need to manually add the specific repository to the package manager. 'sudo add-apt-repository ' will do this for you.
Keyboard shortcuts to learn
by learning the keyboard shortcuts, you can drastically speed up the usage of the command line. Check out some keyboard shortcuts from here.
- Alt + Backspace will delete the previous word
- Alt + B will skip back to the previous space
- Alt + F will skip ahead to the next space
- Ctrl + K to move the cursor to the end of the line
- Ctrl + U to cut the text up to the cursor
- Ctrl + A to move the cursor to the beginning of the line
- Ctrl + E to move the cursor to the end of the line