Linux command | Alias

Posted by in Articles, Linux Hacks

Want to run multiple commands, scripts etc.. by entering a pre-set string… ? You can run alias commands on every Linux OS

1. STEP

create alias.sh with text editor or just type

touch alias.sh

alias linux command

2. STEP

Open alias.sh with text editor. .I like to use sublime, if you don’t have any text editor

sublime alias.sh

or

vi alias.sh

below you can found list of alias commands which I use

alias2


#! /bin/bash
alias do='cd /root/Downloads'
alias pr='ps -efe | grep'
alias d='cd /root/Desktop'
alias cpd='cp -avr'
alias djp='cd /root/Desktop/DJANGO_PROJEKTI'
alias pyp='cd /root/Desktop/PYTHON_PROJEKTI'
alias ext='tar xzvf'
alias com='tar -zcvf'
alias extbz2='tar -jxvf'
alias combz2='tar -jcvf'
alias int='firefox &'
alias als='cat /root/alias.sh'
alias yoed='youtube-dl'
alias yoem='mv /root/*.mp4 /root/Desktop/youtube_videos/'
alias pym='python manage.py'
alias runserver='python manage.py runserver &'
alias syncdb='python manage.py syncdb'
alias collectstatic='python manage.py collectstatic'
alias py='/usr/bin/python'
alias torweb='proxychains iceweasel'
alias mp3='youtube-dl --extract-audio --audio-format mp3'
alias play='clementine'
alias startproject='/usr/local/bin/django-admin.py startproject'
alias mysql_data='cd /var/lib/mysql'
alias scrapy2='/root/.local/bin/scrapy'
alias paint='kolourpaint &'
alias webcam='guvcview &'
alias runxamp='/opt/lampp/lampp start

3. STEP

activate alias command

source alias.sh

Now you can use alias command , for example if I enter djp, I will navigate into folder /root/Desktop/DJANGO_PROJEKTI

alais3

Below you can found list of useful alias commands

:

1) List top ten largest files/directories in current directory


alias ducks='du -cks *|sort -rn|head -11'

2) View apache error logs

alias logs="tac /var/log/apache2/error.log | less"

3)Quick Install

alias agi='sudo apt-get install -y'

4) Find the biggest in a folder


alias ds='du -ks *|sort -n'

5)List files in human readable format with color and without implied directories

alias l='ls -lAh --color'

6) Make and cd into directory

unction mcd() {
mkdir -p "$1" && cd "$1";
}

7) Search for process

alias pss='ps -ef | grep'

8) Run django collectstatic

alias collectstatic='python manage.py collectstatic'