More Linux commands

Get file type

file /etc/hosts
Output first part (10 lines) of the file
head /etc/hosts
Show first 5 lines
head -5 /etc/hosts
Output last part (10 lines) of the file
tail /etc/hosts
Show last 5 lines
tail -5 /etc/hosts
To watch a file for changes with the tail command pass the -f option
tail -f /var/log/messages
How long the system has been up
uptime
Show memory information
free
Display processes
ps -A
Show file system disk space usage
df -h
Pull information about the partitions
fdisk -l
lsblk
Display processes (q to quit)
top
htop
To get user which you are logged in
whoami
id -un
Get more information about the user
id
Show hostname of the system
hostname
See the output of command page by page (q to exit)
hostname --help | less
Set user password
passwd
Get kernel information
uname -a
Get/set the date and time
date
Show last logins that happened on the system
last
To switch between users - you will be prompted for users password
su lora
Switch between users by opening a login shell (the full environment of a target user will be set)
su - lora
Execute commands as root (needs an entry in /etc/sudoers)
sudo ls /root
Become root
sudo -i
sudo su -
su -
Login via SSH to another hostname using specified username
ssh lora@192.168.1.2
Download a file from Internet
curl http://domain.tld/file.txt -O
wget http://domain.tld/file.txt -O file.txt
Check OS version
ls /etc/*release*
cat /etc/*release*
Get networking information
ifconfig
ip a