DEV Community

b0bby_seal
b0bby_seal

Posted on • Updated on

A Tiny List of Useful Commands for Junior Sys-admins

Dependecies:

  • rsync
  • openssh
  • sshfs

Tested on

  • Distro: Headless arch linux (NO_GUI)
  • Kernel: 5.10.10-zen1-1-zen arch: x86_64
  • Hardware: Microsoft Surfacebook 2016 (1st Gen)

Mount network drives onto local machine (sshfs)

  function plug(){
   if [[ $(sshfs -o ciphers=aes128-ctr,compression=no,auto_cache,reconnect,kernel_cache,allow_root ${1} ${2}) ]]; then
    echo ${?}
   fi
 }
Enter fullscreen mode Exit fullscreen mode

Where: $1 ==> remote directory, $2 ==> mount point

Example:
plug <user>@<remote-server>:/home/$USER/Desktop/ /home/$USER/Desktop/

NOTE: Make sure to edit /etc/fuse.conf so that user_allow_other is uncommented

Synchronize folders and network drives

alias sync='rsync --update -vhraz --progress --ignore-existing --human-readable $1 $2'

Where: $1 ==> source directory && $2 ==> destination folder

Example:
sync /home/$USER/Desktop/ <user>@<remote-server>:/home/$USER/Desktop/

SSH shortcut alias

  function link(){
   case $1 in
   *)
    ssh -o "compression=no" -c aes128-ctr $1
   ;;
  }
Enter fullscreen mode Exit fullscreen mode

Where: $1 ==> <host-username>@<host-ip-addr>

Example:
link pi@raspiberrypi.local

NOTE: If you're are security catious I don't recoment using compression=no and aes128-ctr for encryption unless you know what you are doing

source ~/.bashrc without hustle

alias reload='source ~/.bashrc'

You can find shortcuts on my [repo]: https://github.com/munazhe/bashrc-it

Top comments (0)