NOTE: aliases for apt-get are at the top, aliases for systemd’s journalctl (debian version) are at the bottom

Aliases if you dont know make life easier on linux by doing direct substition of a command. Example: If I set an alias for “agi” to be “apt-get install“. To set it type this “alias agi=’apt-get install’“. Then when I type “agi openssh” ENTER (without quotes), the system will acts as if I wrote “apt-get install openssh” (without quotes).

Lets make life easier with some apt-get aliases.

To unalias something just say “unalias <alias name>“. So to unalias the above example: “unalias agi

SYNTAX:

alias aliasname="command to substitute"
unalias aliasname

Below are the most common ones that I use, so I made this article as a NOTE TO SELF – Now I or you or anyone can use these, just copy paste them into your shell. I would recommend making a template entry with them in a clipboard manager such as clcl that way they are always at your finger tips to set.

APT GET ALIAS
###############

Pick one of the methods and stick to it, get used to it. Method4 is most straight forward. I use method1 (as its shortest).

METHOD1
==========

alias aar='apt-get autoremove'
alias acs='apt-cache search'
alias agg='apt-get upgrade'
alias agi='apt-get install'
alias agif='apt-get install -f'
alias agiy='apt-get install -y'
alias agu='apt-get update'
# less common below
alias agbd='apt-get build-dep'
alias agpurge='apt-get purge'
alias agdown='apt-get download'
alias agsource='apt-get source'
alias agclog='apt-get changelog'

 

unalias aar
unalias acs
unalias agg
unalias agi
unalias agif
unalias agiy
unalias agu
# less common below
unalias agbd
unalias agpurge
unalias agdown
unalias agsource
unalias agclog

METHOD2
==========

alias aptar='apt-get autoremove'
alias aptcs='apt-cache search'
alias aptgg='apt-get upgrade'
alias aptgi='apt-get install'
alias aptgif='apt-get install -f'
alias aptgiy='apt-get install -y'
alias aptgu='apt-get update'
# less common below
alias aptbd='apt-get build-dep'
alias aptpurge='apt-get purge'
alias aptdown='apt-get download'
alias aptsource='apt-get source'
alias aptclog='apt-get changelog'

 

unalias aptar
unalias aptcs
unalias aptgg
unalias aptgi
unalias aptgif
unalias aptgiy
unalias aptgu
# less common below
unalias aptbd
unalias aptpurge
unalias aptdown
unalias aptsource
unalias aptclog

 

METHOD3
==========

alias aaar='apt-get autoremove'
alias aacs='apt-cache search'
alias aagg='apt-get upgrade'
alias aagi='apt-get install'
alias aagif='apt-get install -f'
alias aagiy='apt-get install -y'
alias aagu='apt-get update'
# less common below
alias aabd='apt-get build-dep'
alias aapurge='apt-get purge'
alias aadown='apt-get download'
alias aasource='apt-get source'
alias aaclog='apt-get changelog'

 

unalias aaar
unalias aacs
unalias aagg
unalias aagi
unalias aagif
unalias aagiy
unalias aagu
# less common below
unalias aabd
unalias aapurge
unalias aadown
unalias aasource
unalias aaclog

METHOD4
==========

alias aptautoremove='apt-get autoremove'
alias aptsearch='apt-cache search'
alias aptupgrade='apt-get upgrade'
alias aptinstall='apt-get install'
alias aptinstallf='apt-get install -f'
alias aptinstally='apt-get install -y'
alias aptupdate='apt-get update'
# less common below
alias aptdeps='apt-get build-dep'
alias aptpurge='apt-get purge'
alias aptdown='apt-get download'
alias aptsource='apt-get source'
alias aptchanges='apt-get changelog'

 

unalias aptautoremove
unalias aptsearch
unalias aptupgrade
unalias aptinstall
unalias aptinstallf
unalias aptinstally
unalias aptupdate
# less common below
unalias aptdeps
unalias aptpurge
unalias aptdown
unalias aptsource
unalias aptchanges

 

JOURNALCTL SYSTEMD FOR DEBIAN ALIAS
#####################################

With systemd, the logs are now kept in the journal (along with /var/log/syslog, if you have that configured, they can run together – however the default for systemd is just the journal). the journal is called up on:

systemd-journalctl

Most systemd systems have a journalctl file instead of a systemd-journalctl file. So make a symlink to point journalctl to the real file systemd-journalctl

which systemd-journalctl
OUTPUT SHOULD BE: /bin/systemd-journalctl
ln -s /bin/systemd-journalctl /bin/journalctl

Now to get all of the logs from beginning to end:

journalctl -a --no-pager

-a is for all and –no-pager is so that you dont have a pager like as if less is running the code (so you dont have to hit enter to go to next page, etc) so it prints everylog all out on the terminal

Make the alias, as this will be a common command:

alias jour='journalctl -a --no-pager'

If you dont want to make the link and just want the alias:

alias jour='systemd-journalctl -a --no-pager'

To unalias jour:

unalias jour

Leave a Reply

Your email address will not be published. Required fields are marked *