emma_bash - Anton-L-GitHub/Learning GitHub Wiki

Guide to Linux

Command Line

Shell

  • A program that takes your commands and executes them via the OS.

Path

Path Expl
/home/user/Desktop Absolute path from root directory
/folder Relative path from current position

Text-Fu

stdout (Standard Out)

  • When executing a command the reply or output is displayed on the screen by default.
  • The output can be redirected to a file instead: echo Hello World > filename.Example

stdin (Standard In)

  • When writing a command the standard input is by default from the keyboard.
  • The input can also come from a file or output from a process: cat < filename.Example

stderr (Standard Error)

  • Error messages will be displayed on the screen by default, even if the command says to redirect the output.
  • To redirect error messages we have to use file descriptors: ls /nonworking/directory 2> filename.Example

User Management

Users and groups

  • To manage access, permissions and ownership of files and processes.
  • Users home directory /home/username
  • Groups are sets of users with permissions

UID

  • User ID
  • To manage and identify users
  • Checkout users and IDs in /etc/passwd

GID

  • Group ID
  • To manage and identify groups
  • Checkout groups in /etc/group

Different users

User Expl Commad
User regular human user
Daemon runs processes to keep system functioning
Root/Superuser most powertful user in entire system, can do anything `sudo

Sudo

  • Superuser
  • Who can run sudo? Everyone in /etc/sudoers

/etc/passwd

  • Where users and IDs are stored
  • Example: root:x:0:0:root:/root:/bin/bash
Field Expl Note
1 username
2 encrypted user password x -Password stored in /etc/shadow
* -No login access
3 UID (user id) 0 -Root has UID 0
4 GID (group id)
5 GECOS (used for comments and info) , -The info is comma delimited
6 users home directory
7 users shell

/etc/shadow

  • Stores encrypted password and information about user authentication
  • Obs! Requires superuser read permissions
  • Example: root:MyEPTEa$6Nonsense:15000:0:99999:7:::
Field Expl Note
1 username
2 encrypted user password
3 date of last password change 0 -User should change password at next login
4 min number of days before user can change password again
5 max number of days before user has to change password
6 number of days before password expires
7 number of days after password expiration to allow login again
8 account expiration date
9 reserved field for future

/etc/group

  • Stores groups and group members
  • Example: root:*:0:pete
Field Expl Note
1 group name
2 group password (not needed, use sudo) * -No password needed, asterisk is default
3 GID (group ID)
4 list of users

Permissions

File Permissions

  • Files have different permissions
  • Checkout the permissions of a file with ls -l <filename>
  • Example: drwxr-xr-x 2 pete penguins 4096 Dec 1 11:45 .
  • Broken down: d | rwx | r-x | r-x
Field Expl Note
1 filetype d -Directory
- -Regular file
2 user permissions
3 group permissions
4 others permissions
Symbol Expl Note
r filetype d -Directory
- -Regular file
`` user permissions
3 group permissions
4 others permissions
⚠️ **GitHub.com Fallback** ⚠️