Skip to content

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

### 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 ```

Back to top