• [deleted]

  • Edited

alias turbo='sudo cpupower frequency-set -g performance'

It looks like some really powerful stuff here. Enough homework for me to look through and start understanding what each does and how I could use it!!

I use SSH keys so I don't have to type passwords to login to systems that I need to regularly. So these aliases make it even quicker. username, IP and mac addresses have been redacted:

ssh:
alias lexi='ssh username@x.x.x.x'
alias squid='ssh username@x.x.x.x'
alias znc='ssh username@x.x.x.x'
alias tbox='ssh username@x.x.x.x'

Turn on system:
alias wtbox='wol 00:00:00:00:00:00'

Sometimes I'll reboot the server my irc bouncer is on and need to start the service again:
alias rsznc='ssh username@x.x.x.x znc'

Get ip address:
alias getip='wget http://ipecho.net/plain -O - -q ; echo'

System temps:
alias gettemp="sensors && nvidia-smi -a -q | grep -i \"GPU Current Temp\""

Get file permissions in octal:
alias chkoctal='stat -c "%a %n" *'

Backup home folder to external usb drive:
alias rsynchome="rsync -avh --delete --exclude-from='/home/username/.rsyncexclude' /home/username /mnt/Backup/Home"

Update music collection on other system:
alias rsyncpushmusic="rsync -avh --delete /mnt/DataDrive/Music username@x.x.x.x:/mnt/Data/"

Solus packaging:
alias fetchYml="$HOME/repository/common/Scripts/yauto.py"
alias updatePackage='/usr/share/ypkg/yupdate.py'

    Girtablulu and I wrote a simple bashscript with these function for packaging

    Can you share this one? 🙂

    @Harvey why not add a systemd service to start it?

      Harvey For your ssh aliases, you can just add them to .ssh/config. Check out this blog post.

      Sometimes I'll reboot the server my irc bouncer is on and need to start the service again:

      Like what @Justin mentioned, should just use a systemd unit 😃

      # Solus Specific
      alias ap='~/repository/common/Scripts/yauto.py'
      alias ebx='sudo solbuild build pspec.xml -p unstable-x86_64'
      alias reload='source ~/.bashrc'
      alias bashrc='qedit ~/.bashrc'
      alias sr='eopkg sr'
      alias it='sudo eopkg it'
      alias info='eopkg info'
      alias up='sudo eopkg up'
      
      # Directory/File Stuff
      alias ..='cd ..'
      alias l='ls -hl --group-directories-first'
      function mkcd { if [[ -d $1 ]];then cd $1;else mkdir $1;cd $1;fi }

      I have more but they're on my main rig which I am not near currently.

      Justin well get read for some horrible bash scripting 😃

      #!/bin/bash

      usage()
      {
      echo ""
      echo " Syntax: solt [<Order>] [<Argument>]"
      echo ""
      echo " Where <Order> is one of the following orders could be"
      echo ""
      echo " search <Argument> (sr) - Search after eopkg packages with up to 3 search terms"
      echo " info <Argument> (if) - Set information about a eopkg package"
      echo " pkgconf <Argument> (pkg) - Search for package from a pkgconfig()"
      echo " create-repo <Argument> (cr) - Create a new phabricator repo package"
      echo " update-repo <Argument> (ur) - Update phabricator repo package"
      echo " get-repo <Argument> (gr) - Clone phabricator repo package"
      echo " clone-diff <Argument> (cd) - Clone phabricator repo and arc patch a diff"
      echo " newest-source <Argument> (ns) - get the newest source url from a phabricator repo package"
      echo " repo <Argument> - Check if a new package is available or not"
      echo " solbuild-update (sup) - Updates Solbuild"
      echo " clean-local (cl) - Deleted all eopkg files in ../solbuild/local"
      echo " help - Shows this dialog"
      echo ""
      echo " Additional flags: "
      echo ""
      echo " - solbuild-update "
      echo " - co : Updates only the common folders inside the packaging folder"
      echo " - all : Updates Solbuild and common folders"
      echo ""
      echo " - repo"
      echo " - check : Checks the repo list if any mentioned packages have a new update available"
      echo " - add <name> : Adds a repo package to the check list"
      echo ""
      echo " - clone-diff"
      echo " - usage : clone-diff reponame Dxxxx"
      echo ""
      }

      repo=/home/fredu/.solus # where the packaging is
      repo_url=ssh://vcs@dev.getsol.us:2222/source/$2.git
      arg="$1"

      Background color terminal output

      BGC_red='\e[41m'
      BGC_green='\e[42m'
      color_yellow='\e[33m'
      nc='\e[0m\n'

      fileCheck ()
      {
      if [ -z "$1" ]; then
      printf "${BGC_red} Please input package file name. ${nc}"
      exit 1
      elif [ -d "$1" ]; then
      printf "${BGC_red} Directory already exists. ${nc}"
      exit 1
      fi
      }

      rootCheck ()
      {
      if [[ "$EUID" -gt 0 ]]; then
      printf "${BGC_red} ERROR: This operation requires escalated privileges. Exiting! ${nc}"
      exit 1
      fi
      }

      createCommon () {
      git clone https://dev.getsol.us/source/common.git
      ln -sv common/Makefile.common .
      ln -sv common/Makefile.toplevel Makefile
      ln -sv common/Makefile.iso .
      }

      cases

      case "$arg" in
      search | sr)
      shift
      eopkg search "$1" | grep "$2" | grep "$3" | sort
      ;;

      info | if)
          shift
          eopkg info "$1"
      ;;
      
      pkgconf | pkg )
          shift
          python $repo/common/Scripts/epcsearch.py $1
      ;;
      
      create-repo | cr)
          shift 
          cd $repo
          fileCheck $1
          mkdir $1 && cd $1;
          printf "${BGC_green} Please enter package source url: ${nc}"
          read URL
          $repo/common/Scripts/yauto.py ${URL};
          git init;
          echo "include ../Makefile.common" > Makefile;
          printf "${BGC_green} Makefile created ${nc}"
          exec bash
      ;;
      
      update-repo | ur)
          shift
          cd $repo
          fileCheck $1
          git clone $repo_url
          cd $1
          printf "${BGC_green} Please enter new version No: ${nc}"
          read VERSION 
          printf "${BGC_green} Please enter new source url: ${nc}"
          read URL
          /usr/share/ypkg/yupdate.py ${VERSION} ${URL}
          exec bash
      ;;
      
      get-repo | gr)
          shift
          cd $repo
          fileCheck $1
          git clone $repo_url
          cd $1
          exec bash
      ;;
      
      clone-diff | cd)
          shift
          cd $repo
          if [ ! -d "Diff_Clone" ]; then
              mkdir -p $repo/Diff_Clone
              cd  $repo/Diff_Clone
              createCommon
          fi &> /dev/null
          cd $repo/Diff_Clone
          git clone $repo_url
          cd $1
          arc patch $2
          exec bash
      ;;
      
      newest-source | ns)
          shift
          url=$(w3m -dump https://dev.getsol.us/source/$1/browse/master/package.yml | grep 'source :' -A1 | tail -n 1 | awk '{print $2}')
          getnewsource=$(cuppa q $url)
          getrepoinfo=$(eopkg info $1 | grep -m1 "Name" | awk '{print $3,$5}' | sed 's|,| -|; s|,||')
          printf "${color_yellow}Repo version:\e[0m   ${getrepoinfo} ${nc}"
          printf "${color_yellow}Source version:\e[0m ${getnewsource} ${nc}"
      ;;
      
      repo )
          shift
          if [[ $1 == "check" ]]; then
              while IFS= read list; do
              url=$(w3m -dump https://dev.getsol.us/source/$list/browse/master/package.yml | grep 'source :' -A1 | tail -n 1 | awk '{print $2}')
              getnewsource=$(cuppa q $url)
              getrepoinfo=$(eopkg info $list | grep -m1 "Name" | awk '{print $3,$5}' | sed 's|,| -|; s|,||')
                  if [ "$(cuppa q $url | awk '{print $1}')" == "$(eopkg info $list | grep -m1 'Name' | awk '{print $5}' | sed 's|,||')" ]; then
                      :
                  else
                      echo ""
                      printf "${color_yellow}Repo version:\e[0m   ${getrepoinfo} ${nc}"
                      printf "${color_yellow}Source version:\e[0m ${getnewsource} ${nc}"
                  fi
              done < /home/fredu/scripte/Solus/packagelist
      
          elif [[ $1 == "add" ]]; then
              echo $2 >> /home/fredu/scripte/Solus/packagelist
          fi
      ;;
      
      solbuild-update | sup)
          shift
          printf "${color_yellow}Updating... ${nc}"
      
          if [[ $1 == "" ]]; then
              sudo solbuild update > /dev/null 2>&1
              printf "${BGC_green} Solbuild updated ${nc}"
      
          elif [[ $1 == "-co" ]]; then
              for i in $(find $repo -type d -name 'common'); do
                  cd "$i/"
                  git pull > /dev/null
              done
              printf "${BGC_green} Common folder updated ${nc}"
      
          elif [[ $1 == "-all" ]]; then
              sudo solbuild update > /dev/null 2>&1
              for i in $(find $repo -type d -name 'common'); do
                  cd "$i/"
                  git pull > /dev/null
              done
              printf "${BGC_green} Solbuild and Common updated ${nc}"
      
          fi
      ;;
      
      clean-local | cl)
          shift
          rootCheck
          find /var/lib/solbuild/local -type f -name '*.eopkg' -delete &
          printf "${BGC_green} Removed *.eopkg in ../solbuild/local ${nc}"
      ;;
      
      help | --help | -h)
          shift
          usage
      ;;
      
      *)
          shift
          usage
      ;;

      esac

        • [deleted]

        alias admedit="VISUAL=gedit sudoedit"

        Bash

        alias ls='ls --color=auto --group-directories-first -v'
        alias df='df -h -x squashfs' # Thanks popey for this one

        .gitconfig

        [url "https://github.com/"]
         insteadOf = "gh:"
        
        [alias]
        graph = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset %C(cyan)(%an)%Creset' --abbrev-commit --date=relative
        grab = "!f() { git clone git@github.com:tryton-vanmeer/$1.git; }; f"

        First time hearing this alias thing.
        Now i have one alias:

        alias ls="lsd"

        Mostly just the following:

        alias gradlew="./gradlew"
        
        alias generatePkg="$HOME/.solus/common/Scripts/yauto.py"
        alias updatePkg="/usr/share/ypkg/yupdate.py"
        alias useUnstable="sudo eopkg ar Solus https://mirrors.rit.edu/solus/packages/unstable/eopkg-index.xml.xz"
        alias useShannon="sudo eopkg ar Solus https://mirrors.rit.edu/solus/packages/shannon/eopkg-index.xml.xz"

        First one is for Gradle so I can call ./gradlew more easily, and the rest are for packaging/checking unstable for an early look at updates 😛