Thursday, 12 January 2017

25 Linux commands for System Administrators


man

The most important command in Linux, man shows information about other commands. You can start by running “man man” to find more about the man command.

uptime

This command tells you how long your system has been running for.

w

This command shows who is logged into your system and what they are currently doing.

users


This shows you the usernames of users who are currently logged in to your system.

whoami

Prints the username of the user that you are currently logged in as.

grep

Finds text in files and outputs the neighbouring text along with file names. You can recursively search in multiple files using -r. You can output only file names using -l.

less

If the case your output of a command or file contests are more your screen can accomodate, you can view it in parts using less. The output of the previous command using less is the following.

cat

This helps in displaying, copying or combining text files.

pwd

Prints the absolute path of the current working directory.

ssh


This commands helps you connect to a remote host. You can either connect as
   ssh remote_host
or
   ssh remote_username@remote_host

scp

Copy files securely and remotely over servers.

sudo

Use this to run any command as the superuser (root). It is prefixed to the commands.

service

You can use it to perform tasks on different services, which runs scripts for the corresponding services. For instance, to restart apache2 web server, we use service apache2 restart. A sudo is prefixed to run as root because all users do not have permission to run the scripts.
Do note that some do not require sudo.

locate

Find files on your system by name.

chmod

Chmod changes file permissions in Linux. You can set which users or user groups have what kind of access to a particular file. The topic of file permissions in Linux is a huge one in itself and beyond the scope of this post. You can, however, look at this thread for further reading.

chown

Change ownership of a file to a user or a user group.

pkill

Kill a process using this command.

crontab

This is a program that is used to manage cron jobs in Linux. To list existing cron jobs, run crontab -l.

alias

You use an alias when you are in need to shorten a command.
Aliases are not saved after you close the current terminal session. To do that you need to create an alias in ~/.bashrc.

echo

Display or output text. Used in making bash scripts.

cmp

This command compares two files byte by byte.

mount

Mounts a filesystem. There are different options in this command that you can use which enables you to mount even remote file systems.

pmap

This command is used to show the memory map of a process. You can get the process id (pid) by running
   ps aux | grep <process_name>
Then run pmap -x <pid>

wget

Downloads a file from a network.

ifconfig

This command is used to configure a network’s interface. Just writing the command displays the configuration.
With this, we come to the end of the list of the important commands. We hope that it was educational for you. If you have any issues, feel free to comment below!

No comments:

Post a Comment