If you have little or no experience with Linux, this article is a starting point for you to learn about Linux operation. It begins with the essentials of Linux commands such as software installation and extends into slightly more complex topics including user account management.
Install Software on Linux
CentOS / Red Hat Enterprise Linux (RHEL)
To begin with, you can use yum command to find, download and install software through terminal.
Find on Linux
Finding Binaries
After installing software, you may want to find the location for the binary files. You can use commands like “whereis” and “which” to find out information regarding binary file location.
For “whereis” command, you can use it to reveal the binary and manual files of an application.
If you to precisely know where the OS locates the binary files to execute from its PATH variable, you may use the “which” command”. Note that the Linux PATH variable controls where Shell looks for commands entered by a user in a terminal.
Finding Files
If you want to locate an individual file, you can use the “find” command, together with information including the directory to start the search, file type and file name to search for.
For example, you may want to look for NGINX configuration file rather than its binary file. To achieve this, you can enter “find / -type f -name nginx.conf” to look for any file titled “nginx.conf” in the OS. The command will return the directory and file name if it successfully locates the file in the system. Remember to run the command in sudo mode to provide it with required permissions to search into the root directory.
Display Software / File Information on Linux
Look for Application Manual
Sometimes you may want to check the manual for an installed application without looking on the Internet. You can achieve this by using the “man” command. It provides an easy way for you to check the options available to execute an application in a notepad-like format. After finding the information you need, you can simply exit the manual by typing “:q”.
Look for File Information and Access Rights
How about getting information for a file? You can use the “stat” command to look for file information, including file size, access rights, creation date etc. Just execute “stat” and append the path to the file.
User Account Control (UAC)
Get a List of User Account Created
You can get a list of user account created in the Linux OS and information such as UID, GID and home directory by viewing the content inside “/etc/passwd” file. Note that for root user, the UID and GID are both 0.
Check Password Expiry Setting for a User Account
With “chage” command, you can check user account information including its password expiration policy. Remember that “chage” command can only view information regarding the current user if you are not running it with sudo access rights.
Note that for system and bind accounts, they are usually set as password never expire. As indicated by “-1” next to the password policies specified.
Add a User Account
If you want to create a new user account, execute “useradd” command and include the username right-after.
Verify that the newly created user account exists on /etc/passwd file and a home directory has been assigned to the user account.
Change User Account Password
Before logging in the newly created user account, or if you want to change a user account password in general, you can execute “passwd” command. Likewise, you can only change your user account currently logged in. If you would like to change other account’s passwords without individually logging into each account, please login as root user to perform the action.
Conclusion
The commands explained in this article provides you with a starting point to operate Linux OS using the terminal mode. Granted, there are many more commands which you will need to execute shall you become a more advanced user. You will learn and remember commands as you come across operations and look for solutions online. This article will be updated shall I find more commands which you may find useful as a new Linux user.