Contents
  1. 1. Hardware Information
    1. 1.1. Hardware Information
    2. 1.2. CPU
    3. 1.3. Disk
    4. 1.4. Memory
    5. 1.5. Network
  2. 2. System Information
    1. 2.1. System
    2. 2.2. Environment Variables
    3. 2.3. Configuration Files
    4. 2.4. Process
  3. 3. References

Hardware Information

Hardware Information

1
2
3
sudo lshw
sudo lshw -short
sudo lshw -html > lshw.html

CPU

CPU information

1
lscpu

Disk

Block Devices Information

1
2
lsblk
lsblk -a

Disk Usage

1
df -h

Folder Disk Space Usage

1
2
3
4
5
6
7
8
# all subdirectories size and total size
du -h <folder_name>
# -s total size of a directory
du -sh <folder_name>
# -a all files size, subdirectories size and total size
du -ah <folder_name>
# -c add total usage to the last line
du -ch <folder_name>

File Disk Space Usage

1
2
ls -lh .
du -ah <folder_name>

Memory

Memory Information

1
sudo dmidecode -t memory

Memory Usage

1
free -h

Network

Total network traffic

1
2
3
nload
speedometer -t eth0
bmon

traffic by socket

1
2
iftop
iftop -F 192.168.0.1/16

traffic by process ID (PID)

1
nethogs

System Information

System

Linux Distro name and version

1
2
3
4
5
6
cat /etc/os-release
cat /etc/*-release
# or
lsb_release -a
# or
hostnamectl

Linux kernel version

1
2
3
4
5
uname -a
uname -r
uname -mrs
# or
cat /proc/version

System hostname and related settings

1
hostnamectl

Environment Variables

1
env

Configuration Files

Bash Configuration Files

  • /etc/profile - This is a “System wide” initialization file that is executed during login. This file provides initial environment variables and initial “PATH” locations.
  • /etc/bashrc - This again is a “System Wide” initialization file. This file is executed each time a Bash shell is opened by a user. Here you can define your default prompt and add alias information. Values in this file can be overridden by their local ~/.bashrc entry.
  • ~/.bash_profile - If this file exists, it is executed automatically after /etc/profile during the login process. This file can be used by each user to add individual entries. The file however is only executed once at login and normally then runs the users .bashrc file.
  • ~/.bash_login - If the “.bash_profile” does not exist, then this file will be executed automatically at login.
  • ~/.profile - If the “.bash_profile” or “.bash_login” do not exist, then this file is executed automatically at login.
  • ~/.bashrc - This file contains individual specific configurations. This file is read at login and also each time a new Bash shell is started. Ideally, this is where you should place any aliases.
  • ~/.bash_logout - This file is executed automatically during logout.
  • ~/.inputrc - This file is used to customize key bindings/key strokes.

Most global config files are located in the /etc directory

  • /etc/X11/ – xorg specific config files
  • /etc/cups/ – sub-directory containing configuration for the Common UNIX Printing System
  • /etc/xdg/ – global configs for applications following freedesktop.org specification
  • /etc/ssh/ – used to configure OpenSSH server behavior for the whole system
  • /etc/apparmor.d/ – contains config files for the AppArmor system
  • /etc/udev/ – udev related configuration

Important Global Config Files

  • /etc/resolv.conf – used to define the DNS server(s) to use
  • /etc/bash.bashrc – used to define the commands to execute when a user launches the bash shell
  • /etc/profile – the login shell executes the commands in .profile script during startup
  • /etc/dhcp/dhclient.conf – stores network related info required by DHCP clients
  • /etc/fstab – decides where to mount all the partitions available to the system
  • /etc/hostname – set the hostname for the machine
  • /etc/hosts – a file which maps IP addresses to their hostnames
  • /etc/hosts.deny – the remote hosts listed here are denied access to the machine
  • /etc/mime.types – lists MIME-TYPES and filename extensions associated with them
  • /etc/motd – configure the text shown when a user logs in to the host
  • /etc/timezone – set the local timezone
  • /etc/sudoers – the sudoers file controls the sudo related permission for users
  • /etc/httpd/conf and /etc/httpd.conf.d – configuration for the apache web server
  • /etc/default/grub – contains configuration used by the update-grub for generating /boot/grub/grub.cfg
  • /boot/grub/grub.cfg – the update-grub command auto-generates this file using the settings defined in /etc/default/grub

Important User-Specific Config Files

  • $HOME/.xinitrc – this allows us to set the directives for starting a window manager when using the startx command
  • $HOME/.vimrc – vim configuration
  • $HOME/.bashrc – script executed by bash when the user starts a non-login shell
  • $XDG_CONFIG_HOME/nvim/init.vim – neovim configuration
  • $HOME/.editor – sets the default editor for the user
  • $HOME/.gitconfig – sets the default name and e-mail address to use for git commits
  • $HOME/.profile – the login shell executes the commands in the .profile script during startup
  • $HOME/.ssh/config – ssh configuration for a specific user

Process

View Process

1
2
3
top
ps -ef
ps aux

Kill Process

1
2
kill <PID>
kill -9 <PID>

References

[1] 10 Commands to Collect System and Hardware Info in Linux

[2] bash shell configuration files

[3] Configuration Files in Linux

Contents
  1. 1. Hardware Information
    1. 1.1. Hardware Information
    2. 1.2. CPU
    3. 1.3. Disk
    4. 1.4. Memory
    5. 1.5. Network
  2. 2. System Information
    1. 2.1. System
    2. 2.2. Environment Variables
    3. 2.3. Configuration Files
    4. 2.4. Process
  3. 3. References