Introduction to the Linux Operating System
References We Like
New to Linux? Looking for an easy to understand online tutorial or book? Check this out: The Linux Command Line by William E Shotts, jr.
What is Linux?
Just like Windows XP, Windows 7, Windows 8, and Mac OS X, Linux is an operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply – the operating system manages the communication between your software and your hardware. Without the operating system (often referred to as the “OS”), the software wouldn’t function. For more information, visit Linux.com
Working with Linux
While some versions of Linux include a graphical desktop, similar to Windows, server implementations of Linux however do not generally include a graphical interface. Instead, all work is done by entering commands at a text prompt called the Command Line.
Connecting to a Server
Logging into Linux
To log into a Linux server you will need a user account name and password. If you are connecting to the server remotely you would have provided these as part of the SSH command, or Putty configuration. If you are using the Opmantek VM you can find the default passwords HERE: Default Credentials (Passwords) for NMIS8 VM.
Logging In as Root
If the last character of your Linux Prompt is # instead of $ you are logged in as root, which has superuser access. You should never be logged in as root, unless what you are doing absolutely requires that level of access.
Navigating Around the Command Line
The Linux Command Line, or Prompt, allows you to navigate around the file and folder structure, search for information, run programs, create scripts, and configure the server and applications. The sections below provide a basic overview of commands you may find useful while working with Linux.
Understanding the Linux Prompt
The Linux Prompt provides several valuable pieces of information. The example command prompt below provides the current user (root), the host name of the server or IP address if the hostname isn't set (demo.opmantek.com) , the current directory (~) and the level of permissions you are using (# is for root access, )
Last login: Wed May 23 14:26:20 2018 from 192.168.10.10 [root@demo.opmantek.com ~]#
Navigating Around / Changing Directories
Linux organizes programs into files and folders, which are stored on drives or shares. Folders provide the concept of an organizational hierarchy in each share.
How to Determine Where You Are NOW
Typing pwd at the command line, then press Enter will provide the path to your current folder. Notice that the prompt indicates you are in the nmis8 folder, but the pwd command provides the full path /usr/local/nmis.
[root@demo.opmantek.com nmis8]# pwd /usr/local/nmis8
Showing a Listing of Files and Folders in the Current Directory
As we showed above, the Linux Prompt will show you the name of the current folder, or directory, you are in. To provide a list of the files and folders in the current directory you can type ls -l at the command prompt, then press Enter. The ls command will list the directory contents, the -l is an argument passed to the ls command, which tells the command to use the long listing format. There are many more arguments available for the ls command, they can be found on the official Manual page HERE: http://linuxcommand.org/lc3_man_pages/ls1.html
[root@demo.opmantek.com nmis8]# ls -l total 16576 drwxrwx--- 5 nmis nmis 4096 May 12 01:56 admin drwxrwx--- 2 nmis nmis 4096 Apr 28 02:45 bin drwxrwx--- 2 nmis nmis 4096 Dec 1 03:22 cgi-bin drwxrwx--- 5 nmis nmis 4096 May 23 15:03 conf lrwxrwxrwx 1 nmis nmis 21 Apr 15 2014 database -> /data/nmis8/database/ -rw-rw---- 1 nmis nmis 10626 Feb 10 2016 find.patch drwxrwx--- 5 nmis nmis 4096 Dec 1 03:22 htdocs -rw-rw---- 1 nmis nmis 11197 Dec 29 2015 index.html drwxrwxr-x 6 nmis nmis 4096 Dec 1 03:22 install -rw-rw---- 1 nmis nmis 12335212 Dec 1 03:25 install.log -rwxrwx--- 1 nmis nmis 62527 Nov 15 2017 install.pl drwxrwx--- 4 nmis nmis 4096 Dec 1 03:22 lib -rw-rw---- 1 nmis nmis 35801 Nov 15 2017 LICENSE lrwxrwxrwx 1 nmis nmis 13 Apr 15 2014 logs -> /var/log/nmis drwxrwx--- 5 nmis nmis 4096 Apr 15 2014 menu drwxrwx--- 3 nmis nmis 4096 Dec 1 03:22 mibs drwxrwx--- 2 nmis nmis 20480 Dec 1 17:53 models drwxrwxr-x 2 nmis nmis 20480 Dec 1 03:22 models-install -rw-rw---- 1 nmis nmis 1582 Nov 15 2017 README lrwxrwxrwx 1 nmis nmis 25 Apr 6 02:06 var -> /media/ramdisk/nmis8/var/
Linux Permissions Demystified
A good read in this regard: https://blog.superuser.com/2011/04/22/linux-permissions-demystified/