banner
🕒 Reading Time: 2 minutes Today I would like to share a brief introduction to Linux system administration. I was hesitant to approach this topic. There are so many places for people to say “But Erik! You forgot to mention how we XYZ!”. I might be the harshest critic, and I risked letting this post balloon into an expansive overview of Linux administration tasks. We all need to start somewhere, however, so I tried to make a simple post that focuses on checking some common information about the server state and making small, but important, changes.

Connecting

Starting at the very beginning, to log into most Linux servers you are going to use SSH. From a Linux or OS X computer, you can simply open a terminal and type ssh root@xx.xx.xx.xx, where xx.xx.xx.xx is your IP address. There are plenty of advanced uses of SSH, the most common being different usernames and ports, but this command is accurate for a large number of brand new Linux servers. If you are on Windows, you will want to download a tool such as PuTTY, which will provide a graphical prompt for the server information. Upon logging into the server, you will see a command prompt. This can look a little different on different servers, but it will often show a user, hostname, directory or some combination of this information. It would look something like this: [root@servername ~]$ The first part is the user name. The second is the server name (hostname). The third is your current directory. In this case, the directory is ~, which is shorthand for the home directory of the current user.

Commands

Now you can issue commands, one line at a time, to get information or make changes on the server.  For instance, to show the current storage of all mounted drives, listed in human readable units (generally mebibytes and gibibytes): df -h To show all the files in the current directory, listed with permissions and sizes in human readable units: ls -hal Now you may want to edit a file you found. There are many text editors on the Linux command line, each with its own benefits and drawbacks. On almost every Linux server you will find vi or vim. These are very powerful editors, although they do have a steep learning curve. As this guide assumes you are not an experienced administrator, I will note a simpler text editor to get you started. Many modern Linux systems include nano. You can open nano like so: nano filename To save a file, type ctrl-o. To exit nano, type ctrl-x. This will allow you to make basic changes to Linux configuration files, which is one of the key steps toward system administration. One command that will be invaluable to new Linux administrators is man. Man allows you to look up manual pages for Linux commands. If you know a Linux command, but need to learn about its uses and options, type man and then the name of the command, like so: man nano You can scroll up and down with the arrow keys and exit by pressing q. To search for a string, type / and then the string, like so: /option To leave your current login session, type exit. Now you can successfully log into a Linux server, check drive space and look at and edit files. There is quite a bit more about server administration, of course, including how to move around directories and copy and delete files. Stay tuned for more lessons in the future!