Getting Started
Overview
This page should contain the basic information needed to anyone starting out using a Linux server. Much of this information has been compiled from other guides, but I have rewritten and reformatted the content to be more readily available. Some of the content here was referenced from sources such as the Linux Filesystem Hierarchy Standard (Linux FHS).
Man Pages
When encountering issues with Linux servers, its important to know how to gather specific information from credible resources quickly via tools given to us within our Bash terminal. One of these tools is known as the man pages - this set of documentation is not only well maintained and credible in its content but also readily available to us from any terminal.
Local Storage Location
These pages are usually stored locally within /usr/share/man/
where they can be updated as new packages are released and documentation changed. These local files allow us to reference the man pages offline should we disconnect from the internet, and also within /usr/share/man/
you will see locale named directories - these are simply housing different language man pages should you need to reference them. See the example output below when we check the contents of /usr/share/man
ls /usr/share/man/
cs/ es/ hu/ ja/ man2/ man5/ man8/ pl/ ru/ sv/ zh_TW/
da/ fi/ id/ ko/ man3/ man6/ man9/ pt/ sl/ tr/
de/ fr/ it/ man1/ man4/ man7/ nl/ pt_BR/ sr/ zh_CN/
Directory | Content Category |
/usr/share/man/man1 | User programs |
/usr/share/man/man2 | System calls |
/usr/share/man/man3 | Library calls |
/usr/share/man/man4 | Special files |
/usr/share/man/man5 | File formats |
/usr/share/man/man6 | Games |
/usr/share/man/man7 | Miscellaneous |
/usr/share/man/man8 | System administration |
/usr/share/man/man9 | vmxnet.9.gz |
Contents of these directories are optional depending on system and distribution
This may seem like besides-the-fact information - but it's good to know where these files are stored and to step through the locations yourself so you know what resources you have available to you. I would urge anyone interested to check out the contents of these locations from your own system, and then view the man pages associated with some of the topics that stand out to you. This should be relatively easy to do, but for completeness, the below is an example of checking a directory and then viewing the man page of topic I found within it. You will not see the man page in the example below, as it is ran within the active terminal.
ls /usr/share/man/man4
cciss.4.gz initrd.4.gz mem.4.gz random.4.gz vcs.4.gz
console_codes.4.gz intro.4.gz mouse.4.gz rtc.4.gz vcsa.4.gz
cpuid.4.gz kmem.4.gz msr.4.gz sd.4.gz veth.4.gz
dsp56k.4.gz lirc.4.gz null.4.gz smartpqi.4.gz wavelan.4.gz
full.4.gz loop-control.4.gz port.4.gz st.4.gz zero.4.gz
fuse.4.gz loop.4.gz ptmx.4.gz tty.4.gz
hd.4.gz lp.4.gz pts.4.gz ttyS.4.gz
hpsa.4.gz md.4.gz ram.4.gz urandom.4.gz
man console_codes
Indexing Pages
When viewing the manual pages, the amount of information can be overwhelming at times and it is easy to miss subtle things that could prove very useful in a situation where information on a topic is otherwise scarce. We should note that there can be sections to a manual entry for any given package, these sections are indexed according to the number of the corresponding category that the referenced package subtopic falls under. Its really useful and easy to understand once you work with it a bit. See the commands below, where we check for all man pages associated with whatis intro
, and then look for the correspondence in the Local Man Page Storage table above.
whatis intro
intro (1) - introduction to user commands
intro (2) - introduction to system calls
intro (3) - introduction to library functions
intro (4) - introduction to special files
intro (5) - introduction to file formats and filesystems
intro (6) - introduction to games
intro (7) - introduction to overview and miscellany section
intro (8) - introduction to administration and privileged commands
find /usr/share/man/man* -name intro*
/usr/share/man/man1/intro.1.gz
/usr/share/man/man2/intro.2.gz
/usr/share/man/man3/intro.3.gz
/usr/share/man/man4/intro.4.gz
/usr/share/man/man5/intro.5.gz
/usr/share/man/man6/intro.6.gz
/usr/share/man/man7/intro.7.gz
/usr/share/man/man8/intro.8.gz
So, the intro manual pages proves to be a perfect example since its easy to relate this information to our table above. Below, we ask whatis time
whatis time
time (1) - run programs and summarize system resource usage
time (7) - overview of time and timers
time (3am) - time functions for gawk
Then look into the results by running man <PageID> time
where <PageID>
corresponds with the page we'd like to view.
user@knoats:~$ man 3am time
We see that the information is organized as we expect, having researched the Local Man Page Storage above. The first section, time (1)
, is a man page for the time command and how to use it when running user programs. The next section, time (3am)
, The final section, time (7)
, is a general overview of time and timers within Linux.
Text Editor
You will need to edit text when working in Linux, and a popular and powerful tool for doing so is vim. Vim can be a tricky program to use at first, but there are resources available to help teach vim to newcomers. There is even a commandline tutor that will walk you through vim from within the default viewport of a terminal using interactive text tutorials. to run this tutorial, simply run vimtutor
from any Linux commandline. I would elaborate more on this topic, since it is such an important tool within Linux Server Administration - but there are plenty of tools and resources out there that offer much more information. Instead, I'll link to some good information here. Or, if you don't have immediate access to a terminal, check out a quick google search for some vim interactive tutorials and you're sure to find some games available to teach you within a web browser.
Plugins / Enhancements | |
Syntax Checker for Vim | https://github.com/vim-syntastic/syntastic |
Snippets | https://github.com/SirVer/ultisnips |
Vim Solarized | https://github.com/altercation/vim-colors-solarized |
Code Completion | https://github.com/ycm-core/YouCompleteMe |
Git Plugin | https://github.com/tpope/vim-fugitive |
Auto Configuration Tool | https://github.com/chxuan/vimplus |
Community Vim Distribution | https://github.com/SpaceVim/SpaceVim |
Everything Else | https://github.com/mhinz/vim-galore |