Making the switch to Linux can be a little intimidating. A new operating system? Different Desktop? Everything that you have known in computing has changed? Although the switch may seem scary at times, it can be more productive and quite rewarding. Learning new things is your first step.
What is terminal?
Before you can begin learning the ins and outs of Linux, you will need to understand what terminal is. The terminal is Linux’s version of the command prompt or powershell. Linux, which was originally created as a command-line operating system, added a graphical interface for ease of use because of its growing popularity The Linux operating system, in its most productive form, uses terminal.
Terminal commands are unlike most applications you may be familiar with. They are unlikely to spawn a new window, as the results are executed immediately within the terminal application. Terminal commands may also have additional options, which are called “switches.” Switches are used to add functionality to the requested command line operation. Below you will find 5 of the “must know” commands when switching to Linux.
1. “man” command
man command is going to be the most useful of commands for users new to Linux or terminal. Man is short for “manual,” which is the term for a Linux help document. Every terminal command has a man page, even the “man” command.
If you know the name of the Linux command, function or file you are interested in, simply type
man command name and hit Enter. Below represents what running the above command results would be.
2. “ls” command
ls command is a great tool to see what directories or files reside in your current location or throughout the file system. It is installed in Linux distributions by default, as it is part of the GNU core utilities package. To use this command is as simple as typing
ls in your terminal window. This will show you the results of your current working directory.
Using advanced switches can help provide specific results in addition to other functions. Below are additional example of “ls” using switch options.
To show files and directories, size, modified date / time, owner and permissions:
To sort files in current working directory by size:
To list directory information for a directory that is not the current working directory:
ls -l <directory name>
3. “cd” command
cd command is another useful command and is used to change from the current working directory. The below examples will show the functionality of the “cd” command.
To change to a subdirectory:
cd <directory name>
To change to a subdirectory multiple directories away from the current location:
cd <target directory path>
This command can be continued indefinitely, assuming there is a directory level to switch to. The target directory path we will use is “example/example2/example3.”
To change the directory to the home directory of the user:
4. “ifconfig” command
This Linux command may look a little odd if you have worked a long time using Windows operating systems. “ifconfig” is very similar to the Windows version of the command “ipconfig.” This command is not installed by default in all Linux distros. In order to obtain this functionality, the user can install the package by running
sudo apt get install net-tools from the terminal (if you are using Debian-based distro). Once installed, using this command will provide the user with the current IP-addressing information for your device.
This command has a number of uses from assigning an IP address to a specific interface to modifying an interface’s MAC address for spoofing attacks. Below are some entry-level examples of “ifconfig.”
To view network settings of a specific interface:
ifconfig <interface name>
To disable a network interface:
ifconfig <interface name> down
To enable a network interface:
ifconfig <interface name> up
5. “find” command
When attempting to find a file by a specific name or extension in Linux, it is best to use the
find command. Some of the examples below can be very useful for new user learning to navigate within the Linux terminal.
To search for a file with the filename:
To search for all the “png” files in “/home/Desktop” and its subdirectories:
find /home/linuxtest -name *.png
6. “clear” command
When your terminal is filled up with text, the best way to clear it is with the
clear command. This clears the screen in your view and allows you to start again with just the prompt. In some cases you can also use Ctrl + l, which will perform the same task.
In conclusion, we covered the most useful commands that a beginner should know. In addition to these, there are many more commands which you can run in a Linux terminalas well as some commands you should never run. Learning these commands won’t make you want to quit your day job and become a tech guru, but it may make your transition to Linux that much easier.
Our latest tutorials delivered straight to your inbox