Command | Comment |
---|---|
uname -a | Show linux system information |
uname -r | show kernel version |
uptime | Display system activity time and load |
hostname | Displays the hostname of the machine |
hostname -I | Displays the IP address of the host |
last reboot | Show reboot history |
date | Show System Date and Time |
cal | Displays the calendar of the month. |
w | Poster that's online |
whoami | Poster where we're logged in as the who |
Command | Comment |
---|---|
dmesg | Displays kernel messages |
cat /proc/cpuinfo | Displays CPU information |
cat /proc/meminfo | Displays RAM information |
free -h | Displays free and used memory (-h for human readable, -m for MB and -g for GB) |
lspci -tv | Display PCI devices |
lsusb -tv | Displays USB devices |
dmidecode | Display DMI/SMBIOS information (system information) from the BIOS |
hdparm -i /dev/sda | Displays information about the /dev/sda disk. |
hdparm -rT /dev/sda | Test the read speed on the /dev/sda disk |
badblocks -s /dev/sda | Test the /dev/sda disk for bad blocks |
Allows you to list the contents of a directory.
Syntax:
ls <option> directory
Option | Comment |
---|---|
-a | List the entire directory (including hidden files). |
-l | Display the directory in table form, with permission, ... |
-i | Shows the inodes |
-h | Displays the size in a human-readable format (e.g. Mb) |
-R | Lists also subdirectories |
-s | Shows the size of the directories |
Displays the directory you're in.
Syntax:
pwd
Create a directory.
mkdir -p /path/directory/to/create
Option | Comment |
---|---|
-p | Create parent directories if they don't exist |
Example: I want to create a thing directory in /home/user1/test1, but the test1 file doesn't exist.
Syntax :
mkdir -p /home/user1/test1/thing
Allows you to move around the tree structure Allows you to move around the tree structure
Syntax:
cd /directory/destination
Allows you to open a file and display its contents.
Syntax :
cat <option> file
Option | Comment |
---|---|
-b | Number all non-empty lines |
-n | Number all lines |
Allows you to display the size of a directory.
Syntax :
df <option> directory
Option | Comment |
---|---|
-h | Gives a more readable result for a human. |
-i | Shows the inodes |
-k | Display the result in kilobytes. |
-m | Display the result in megabytes. |
-d n. | Displays the size of the subdirectories up to the n. |
Allows you to move a file or a directory.
Syntax :
mv <option> /source/path /destination/path
Option | Comment |
---|---|
-f | forcing displacement |
-i | Request user confirmation |
Allows you to delete a file or a folder
Syntax:
rm <option> /path/thing/to/delete
Option | Comment |
---|---|
-d | Delete a directory |
-f | Force Deletion |
-i | Request confirmation from user (Not necessary with -f ) |
-r | Recursive |
Allows you to display in which groups the user is in.
Syntax:
user groups
Allows you to change a user's password.
Syntax:
passwd <option> user
Option | Comment |
---|---|
-d | Delete Password |
-e | Expire password |
-i | Make an account inactive |
-l | Locks the password and prevents it from being changed by the user. |
-S | Display account status |
-u | Unlock a password. |