Skip to content

0x324 Linux Admin

1. Service Management

The initialization daemon is the first process to be started by the kernel on the Linux server (with ppid 0 and pid 1). The original implementation was BSD init and SysVinit. Currently many linux distributions are adopting systemd (e.g: Ubuntu, RHEL, Fedora distributions)

runlevel is a categorization number that determines what services are started and what services are stopped.

2. Network Management

(sudo) netstat -tupln see all listening tcp/udp pid programs

3. Package Management

3.1. Debian

3.2. Redhat

yum list available | grep postgres: search available packages

4. File System Management

/proc/sys/fs/file-max: file limit

/proc/sys/fs/file-nr: currently opened files

5. Utilities

5.1. Awk

awk '!seen[$0]++' text: remove duplicates from text

5.2. Others

shuf input.txt > output.txt : shuffle lines of a given file

6. Credentials

6.1. Users / Groups

File (/etc/passwd) nonsensitive system password file

  • login name: unique user name encrypted password: DES hash of password, x if shadow password enabled
  • User ID (UID): superuser (root) if value 0
  • Group ID (GID): group id of the first group
  • Comment: text about the user
  • home directory: HOME variable
  • login shell: shell

File (/etc/shadow) sensitive password file. password hash is saved here

File (/etc/group) group info (note that part of the info is saved in /etc/passwd) . current login user's group can be checked with group (1)

  • group name: unique group name
  • encrypted password: group password, x if shadow password enabled
  • group ID (GID): group id
  • user list: users

7. Terminal

stty -a: show terminal line settings

8. Reference

[1] Linux Bible