Linux Command Note

Count folder's size

du -sch /path/to/folder/*type

Set Time & Date NTP

sudo timedatectl set-ntp yes

Scan WiFi

sudo iwlist wlan0 scan

Set default shell

sudo ln -fs /bin/bash /bin/sh

APT Search Package

sudo apt-cache search keyword

APT Error Fix

If it shows

E: Encountered a section with no Package: header

Just clean the error link

sudo rm /var/lib/apt/lists/* -vf

And then

sudo apt-get update

Start SSH

sudo /etc/init.d/ssh start

Change SSH Port

sudo vim /etc/ssh/sshd_config

then

sudo service ssh restart

Regenerate SSH Key

ssh-keygen -R "you server hostname or ip"

Check crontab status

sudo /etc/init.d/cron status

Set crontab

Edit cron

crontab -e

Remove cron

crontab -r

List cron

crontab -l

Start cron

sudo service cron start

Stop cron

sudo service cron stop

Reload cron config

sudo service cron reload

Restart cron

sudo service cron restart

Check cron status

sudo service cron status

Set default path of terminal

echo 'cd ~/Desktop/' >> ~/.bashrc

If in MacOS, use

echo 'cd ~/Desktop/' >> ~/.bash_profile

Zip

zip

  • -h Show the help interface
  • -m After the file is compressed, delete the original file
  • -o Set the latest change time of all files in the archive to the time of compression
  • -q Quiet mode, does not display the execution of instructions during compression
  • -r Treats all subdirectories under the specified directory together with the file
  • -P Set the compression password

Unzip

unzip

  • -l Show the files whitch contained in the compressed file
  • -t Check if the compressed file is correct
  • -P<password> Unzip files with password

Terminal

  • Ctrl + Alt + F2 = Terminal
  • Alt + F7 = Exit Terminal

Vim

Paste content: Shift + Ins Or Shift + right-mouse-click

Rclone

Show process every 1 second when upload files:

rclone copy -v --stats 1s [File] [Target]

Remove rclone:

sudo rm /usr/bin/rclone
sudo rm /usr/local/share/man/man1/rclone.1

Rclone Config File

rclone -h | grep "Config file"

Google API Google Console

Check Nginx config file syntax

nginx -t -c /etc/nginx/nginx.conf

Screen

Kill specific screen

screen -S [pid/name] -X quit

Or

kill [pid]

Kill all screen

killall screen
Copyright © carry0987 all right reserved,powered by GitbookLast Modified : 2024-04-08 11:07:13

results matching ""

    No results matching ""