Learning how to navigate the Linux command line is crucial. There are hundreds of Linux commands you can use. Let’s focus on a few crucial ones.
Short for “superuser do”, sudo is one of the most basic Linux commands you should know. The sudo command lets you perform tasks that require admin or root access.
When you use sudo, it will ask for your password. Every root user can run sudo commands for 15 minutes per session.
Whenever you’re ready to run some advanced commands in the command line, just type sudo and then the command.
The man command provides a manual of all commands or tools you can run in the Terminal. It includes the name, description, and options.
To display the complete manual, type in man [command name]. For example, if you want to see the manual for the mkdir command: man mkdir.
You can even specify where in the manual you want to start so if you want to view section 1 of the mkdir command manual: man 1 mkdir.
You can use the kill command to close a process that isn’t working properly.
Using kill is a little complicated because you need a process identification number (PID). Each program in Linux has one.
If you don’t know the PID, run this command: ps ux.
Once you see the PID you can move on to the next phase, adding a signal option. There are a lot of them, but the most common signal options are SIGTERM and SIGKILL.
A completed kill command syntax looks like this: kill SIGKILL 27375.
Ping is one of the most basic Linux commands used for network troubleshooting. You can use it to check if a network or server is reachable.
If you’re familiar with Windows command prompt, it works similarly.
Here’s the syntax: ping yahoo.com.
Apt-get is a Linux command that allows you to search, install, manage, update, or remove the software.
To install files, apt-get compiles code or uses precompiled files to install the software.
Before installing a package, it’s essential to update to the latest version. Update by running apt-get update.
To install a package, type in apt-get install [package_name].
To remove a package: apt-get remove [package_name]. Typing in apt-get purge [package_name] will remove the package and its configuration files.
Like with the Windows command prompt, type in your Linux commands very carefully. The terminal will do exactly what you say. If a file is deleted, it’s gone!
Use sudo to run things in admin mode. Try the man command to get detailed manuals of all commands. Terminate unresponsive or unwanted processes with the kill command.
Ping a website or server if you’re having internet issues. And get comfortable with using apt-get whenever dealing with any Linux packages.