Linux Basics:
Intro
The Linux operating system is open-source, and continuously developed and improved by every interested person. All the people involved in usage, testing and development of open-source projects are referred to as Community.
Any linux or unix like OS are similar in their filesystem structure, user management and many other things. But they are not the same.
Everything in linux is stored as files, including devices, cpu, memory and data files themselves.
Main difference between Windows and Linux filesystems is that Linux is case-sensitive and Windows is case-insensitive. Meaning, that in linux filesystem following file names will represent two different files:
testfile.txt
Testfile.txt
Furthermore, Windows OS will determine file type depending on its extension while linux will try to look inside and understand what is the content.
./testfile.txt # Windows identifies that the file is textual data by extension
./testfile # Linux will look at the file content, ignoring the extension
Windows executable file has extension of .exe while Linux executable file has EXECUTE permissions set.
Directory Structure
Linux filesystem main folder (root) is always / while in Windows you may find disks like C:\ D:\ and others.
In Linux, external drives are mounted to specific path like /media/root/DRIVE
Most interesting default linux directories found in /:
/bin # core programs (commands)
/dev # contains devices
/etc # system configurations
/home # users home directories
/media # default path for external storage mount
/proc # process information
/root # root’s home directory
Commands and their rules
Probably the most useful command argument for the linux beginner is --help or -h.
Almost every command and programs in the linux operating system accept this argument which provides a lot of useful information on the executed command.
You may try for example:
cd --help
ls --help
cat --help
Each of them will print an extended help manual for the command.
Please note that some commands accept short syntax (-h) and long syntax (--help).
Try to remember that some commands require space between the argument and it’s value (-p value), some don’t require that -pvalue and some don’t require ‘-’ character before the argument (tar xzvf file.tar.gz).
That all depends on the command itself.
Basic commands and their descriptions:
value => required value
[value] => optional value
Users:
Each linux system has its administrator user, and commonly its name: root
Home directory of the root user: /root
By default each additional user’s home directory is created under /home directory
For example, if our system has labuser, probably its home directory will be found at /home/labuser
Basic information about each user is stored in /etc/passwd file.
$ cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
user:x:1000:1000::/home/user:/bin/bash
Each line in /etc/passwd file represents the following:
/-----> User name
| /----> Encrypted password (x refers that the password in shadow file)
| | /----> User ID number (UID)
| | | /----> User's group ID number (GID)
| | | | /----> Full name of the user (GECOS)
| | | | | /----> User home directory.
| | | | | | /----> Login shell.
| | | | | | |
user:x:1000:1000:Full Name:/home/user:/bin/bash
Password information of each user in linux stored in /etc/shadow file:
$ cat /etc/shadow
user:$6$.n.:17736:0:99999:7:::
| | | | | |||\-----------> 9. Unused
| | | | | ||\------------> 8. Expiration date
| | | | | |\-------------> 7. Inactivity period
| | | | | \--------------> 6. Warning period
| | | | \------------------> 5. Maximum password age
| | | \----------------------> 4. Minimum password age
| | \--------------------------> 3. Last password change
| \---------------------------------> 2. Password Hash
\----------------------------------------> 1. Username
This file (/etc/shadow) is accessible only to the root user since it’s permissions:
$ ls -la /etc/shadow
-rw-r----- 1 root shadow 1799 Jul 29 15:44 /etc/shadow
No comments:
Post a Comment