You Got A Question? Ask    GNOME Community!


8 Lazy Geek Terminal Aliases You Should Have

Automation of tasks in terminal is something natural in our favorite distribution. There are literally tons of scripts that run other scripts that are being executed by other scripts. Most of them though, have some weird names and you constantly use them with the same parameters over and over again…

One common way to automate the typing of a system command with its parameters is to create a “human readable” word and link it with that command.

This can be done by creating Aliases.

Alias: an alternative name or label that refers to a file, command, address, or other item, and can be used to locate or access it. — Wikipedia

Aliases can be simple words, that are easy to remember and descriptive of the actions that they perform. You can add your alias in a hidden file inside your Home directory called “.bashrc” .

The syntax to create aliases is :

alias Word='command'

To use them:

$ Word

terminal-aliases

So lets get started… shall we ? Open your favorite text editor and open your .bashrc. You can start puting the following aliases at the end of the file. You can adjust any part of the aliases presented here, to your liking and make it perform the analogous action that is part of your distribution.


1 – Update my apps list

alias Update='sudo apt-get update'

2 – Install any available Upgrades

alias Upgrade='sudo apt-get dist-upgrade'

3 – Perform a cleanup of unnecessary packages

alias Clean='sudo apt-get autoremove && sudo apt-get autoclean
&& sudo apt-get clean'

4 – Uninstall an app with its configuration files

alias Remove='sudo apt-get purge'

5 – Install “that” app

alias Install='sudo apt-get install'

6 – Restart my system…. NOW !

alias Restart='sudo shutdown -r now'

7 – Shutdown my PC… NOW !

alias Poweroff='sudo shutdown -h now'

8 – Edit my awesome aliases

alias Editaliases='gedit ~/.bashrc'

Epilogue

Please do share with us any aliases that you have created so that other members of the community can use them. Last but not least, because we talked about laziness, you can just copy the following list and put it in your .bashrc file :)

alias Update='sudo apt-get update'
alias Upgrade='sudo apt-get dist-upgrade'
alias Clean='sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean'
alias Remove='sudo apt-get purge'
alias Install='sudo apt-get install'
alias Restart='sudo shutdown -r now'
alias Poweroff='sudo shutdown -h now'
alias Editaliases='gedit ~/.bashrc'

 
  We can't watch comments unless G+ provides an API or if you send a notification, e.g +World Of Gnome
     Sometimes is better to place your questions on GNOME Community
  • Pingback: 8 Lazy Geek Terminal Aliases You Should Have | Linux news

  • IsacDaavid

    most are APT-related, and I think systemd already provides poweroff and reboot. Here are my favorite ones:

    #prints a fortune-cowsay ASCII art on exit
    alias exit=”fortune’ -a | ‘fmt’ -80 -s | $(‘shuf’ -n 1 -e ‘cowsay’ ‘cowthink’) -$(‘shuf’ -n 1 -e b d g p s t w y) -f $(‘shuf’ -n 1 -e $(‘cowsay’ -l | ‘tail’ -n +2)) -n; ‘read’; ‘exit”

    #repeat last command with sudo
    alias please=’sudo !!’

    #safety measures
    alias cp=’cp -i -v’
    alias mv=’mv -i -v’
    alias rm=’rm -I -v’
    alias ln=’ln -i’

    #colorful output
    alias ls=’ls –color=auto’
    alias grep=’grep –color=auto’

    • http://www.cerebrux.net/ Salih Emin

      Thanks @isacdaavid:disqus I copied them into my personal .bashrc !

  • Pingback: Simple useful aliases | 0ddn1x: tricks with *nix