Cyan Hall C H
Created by CyanHall.com. Last updated: 11/25/2020 👉   Get the meaning of Shell command: just copy it and paste to explainshell

1. Change the default Shell

    chsh -s /bin/zsh
  

2. Check the size of a file/Directory

    du -sh [filePath/Directory]
  

3. Force delete files inside directory

    rm -rf dir
# -f for force, -r for recursive
  

4. Find file with a given pattern

    find / -name filename.xx
  

5. Remove files with a given pattern

    find . -name '*.pyc' -delete # remove all .pyc files from a project
  

6. Find all proccess with a name

    ps aux | grep [name]
  

7. Kill proccess with a name

    kill $(ps aux | grep [name] | awk '{print $2}')
  

8. View a log in realtime

    tail -f filename.log
  

9. Check netwok connectivity

    nc -z -v [ip] [port]
  

10. Check used port

    sudo lsof -i:[port number]
  

11. Downloading file with breakpoint resume

    wget -c [url]
  

12. Download file from remote server

    scp -i ssh-key-file [user]@[ip]:remote/file/path local/file/path
  

13. Upload file to remote server

    scp -i ssh-key-file [file/to/send] [user]@[ip]:[dest/path]
  

14. Give a script the execution permission

    chmod +x ./script.sh
  

15. Generate New SSH key files

    ssh-keygen -t rsa -C "remark"
  

16. Start SSH agent

    eval `ssh-agent -s`
  

17. Limit ssh key file access

    chmod 400 [key-path]
  

18. Enable a ssh key

    ssh-add [key-path] # without .pub
  

19. Create a socks v5 proxy with SSH

    ssh -i ssh-key-file -o IdentitiesOnly=yes [username]@[ip]  -D 127.0.0.1:1007
  

20. Shell Loop

    for i in `seq -w 000 3`;do echo test_"${i}";done
# Output:
#  test_000
#  test_001
#  test_002
#  test_003
  

21. macOS

    say hello world
# list all langs
say -v '?'
# list all file format
say --file-format=?
say -v Ting-Ting -o test.aac hello world