Skip to content

Instantly share code, notes, and snippets.

@aic25
Last active January 15, 2019 02:10
Show Gist options
  • Save aic25/2f34fcd0818251179b85a09ae2e54b92 to your computer and use it in GitHub Desktop.
Save aic25/2f34fcd0818251179b85a09ae2e54b92 to your computer and use it in GitHub Desktop.
Shell memo
file transfer
rsync -uvr -e ssh Study/* server:/home/me/Study/
scp ~/.ssh/id_rsa.pub darvader@deathstar.empire.gov:
sshpass -p "password" scp -r user@example.com:/some/remote/path /some/local/path
or
sshpass -f "/path/to/passwordfile" scp -r user@example.com:/some/remote/path /some/local/path
pscp .\Documents\DummyF\Dummy-d.txt server:DummyFolder/
apt-cache show zim | grep '^Recommends:'
find (can execute on files found), locate (easier to use), ln -s targetfile linkname
chmod u+rwx,go-rwx hello
grep pattern1 file | grep -v pattern2
read only system: sudo mount / -o remount,rw
run remote command: ssh user@server "shutdown -h now"
install with suggests:
sudo apt-get --install-suggests install <package name>
aptitude install '~Rsuggests:^network-manager$'
sudo apt-get -o APT::Install-Suggests="true" install conky
sudo apt-get install --install-recommends zim
du -hs <paths> for folder size
uname : print ceratin system information, default option is -s.
sort: sort lines of text files
cut : remove sections from each line of files
which : locate a command
whereis : locate the binary source and manual page files for a ..
locate : find files by name
bashdb : bash debugger script
bashdebug :
set -x # activate debugging from here
<part of script to debug>
set +x # stop debugging from here
env, printenv
diff: compare files line by line
# list jupyters running
ipython -c "system("jupyter" "notebook" "list")"
# Run .sh from specific line
bash <(sed -n '5,$p' script.sh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment