Linux
Commands
List all envirlonment variables
printenv
Editing the crontab
crontab -e
Editing the systemd service
vim /etc/systemd/system/xxx.service
To check all the systemd services on a Linux system
systemctl list-units --type=service
Checking the listening port
lsof -i tcp:8080
Change the hostname
- Open the terminal and enter the following command to edit the hosts file:
vim /etc/hosts
- In the hosts file, look for the line that contains the current hostname and edit it to the new hostname that you wish to use. Replace "old_hostname" with the current hostname and "new_hostname" with the new hostname you have chosen.
127.0.0.1 old_hostname
Change it to:
127.0.0.1 new_hostname
- Now, enter the following command to edit the hostname file:
vim /etc/hostname
-
Replace the old hostname with the new hostname that you have chosen, and then save and close the file.
-
Reboot your system using the following command:
reboot
To find the specify process
ps -ef grep | xxx
To find the process by name
ps aux | grep xxx
find the Correct USB Device Name
lsblk
copy the ISO image to the USB flash drive
dd bs=1M conv=fdatasync if=./proxmox-ve_*.iso of=/dev/XYZ
SSH
Start the ssh-agent
eval "$(ssh-agent -s)"
To add ssh private key
ssh-add xxxx
To calculate the sha256 in macOS
shasum -a 256 filename
Network
to display the detailed output of the curl command
curl -v https://google.com
create a VLAN interface
ip link show
ip link add link eth0 name eth0.10 type vlan id 10
ip link set eth0.10 up
ip addr add 192.168.10.2/24 dev eth0.10 // optional
Disk
list the disk usage
df -h
list the large files
du -ah / | sort -rh | head -n 10