{ 73 comments… read them below or add one }

1 mchris June 11, 2012 at 6:37 am

Nice list; found a couple new things I never thought of. To return the favor; my addon..

A nice shell is key in bash imo; I color code my next line based on previous commands return code..

bash_prompt_command()
{
    RTN=$?
    prevCmd=$(prevCmd $RTN)
}
PROMPT_COMMAND=bash_prompt_command
prevCmd()
{
    if [ $1 == 0 ] ; then
        echo $GREEN
    else
        echo $RED
    fi
}
if [ $(tput colors) -gt 0 ] ; then
    RED=$(tput setaf 1)
    GREEN=$(tput setaf 2)
    RST=$(tput op)
fi
export PS1="\[\e[36m\]\u.\h.\W\[\e[0m\]\[\$prevCmd\]>\[$RST\]"

And I liked your .{1,2,3,4} mapping; how I integrated it…

dotSlash=""
for i in 1 2 3 4
do
    dotSlash=${dotSlash}'../';
    baseName=".${i}"
    alias $baseName="cd ${dotSlash}"
done

And two random quick short ones..

#progress bar on file copy. Useful evenlocal.
alias cpProgress="rsync --progress -ravz"
#I find it useful when emailing blurbs to people and want to illustrate long timeout in one pass.
alias ping="time ping"

Reply

2 Scott Rowley March 22, 2013 at 2:15 pm

The following is my version of the “up function” I came up with this morning:

# Functions
up () {
        COUNTER=$1
        while [[ $COUNTER -gt 0 ]]
         do
          UP="${UP}../"
          COUNTER=$(( $COUNTER -1 ))
         done
        echo "cd $UP"
        cd $UP
        UP=''
}

Reply

3 linuxnetzer June 11, 2012 at 6:45 am

Show text file without comment (#) lines (Nice alias for /etc files which have tons of comments like /etc/squid.conf)

alias nocomment='grep -Ev '\''^(#|$)'\'''

Usage e.g.:

nocomment /etc/squid.conf

Reply

4 Vivek Gite June 11, 2012 at 6:58 am

@linuxnetzer, nocommand is nice to dump squid, httpd and many others config files.

@mchris, I liked cp alias that can show progress.

Appreciate your comments.

Reply

5 Tom Ryder June 11, 2012 at 6:58 am

Ctrl+L is also a nice quick way to clear the terminal.

Reply

6 TooManySecrets June 11, 2012 at 7:32 am

Hi!
This isn’t an alias, but for clear screen is very handy the CTRL+L xDD

Have a nice day ;-)
TooManySecrets

Reply

7 Sean June 11, 2012 at 8:01 am

One that I find useful is:

alias du1='du -d 1'

Reply

8 Sergio Luiz Araujo Silva June 11, 2012 at 10:12 am

apt-get with limit

alias apt-get="apt-get -o Acquire::http::Dl-Limit=15"

To open last edited file

alias lvim="vim -c \"normal '0\""

Reply

9 Tales Teixeira January 11, 2013 at 1:55 am

Try !vim

Reply

10 Sdaiy June 11, 2012 at 12:34 pm

Nice list. Never knew about some of these aliases and commands.

Reply

11 satish June 11, 2012 at 1:23 pm

good list, an alias I use commonly
ll “ls -l”

Reply

12 oll June 11, 2012 at 2:31 pm

Nice tricks.
But be careful with some aliases (typically the #7 mount), since you won’t be able to use them directly when you pass arguments .

[root@myhost ~]# alias mount=’mount |column -t’
[root@myhost ~]# mount myserver:/share /mnt
column: myserver:/share: No such file or directory

It’s better to use scripts whith these kinds of commands

Reply

13 Fumando_Espero January 8, 2013 at 2:32 pm

You are very right in your appreciation. An alias is a “dumb” substitution in that it doesn’t interpret arguments.

Reply

14 booczczu May 10, 2013 at 3:19 pm

Do it this way:

alias mountt=’mount |column -t’

(note the double “t”) and than you can use the original mount command to do its job.

Reply

15 mchris June 11, 2012 at 2:47 pm

In reply to comment of “Reopen last edited file in vim”, alternative recommendation that will be more portable to other uses…

vim

Can also use history here; if you edited /etc/host 4 files ago; you can just type host and you’re good to go. Works with all commands; I use it constantly.

(Also, is also incredibly useful. Also accepts direct place in previous commands)

Reply

16 Rob June 11, 2012 at 3:05 pm

Don’t forget… sl=”ls”. Though Steam Locomotive is funny for a while, this is always the easier solution.

Reply

17 Vivek Gite June 11, 2012 at 4:49 pm

@oll

\mount myserver:/share /mnt

And you are done with it. No need to write scripts.

Reply

18 esritter June 11, 2012 at 5:22 pm

My bashrc has been with me for over a decade. I love to tinker and modify it a bunch, so I’ve added an alias I borrowed/stole/ganked from someone ages ago:

alias='$EDITOR ~/.bashrc ; source ~/.bashrc'

Reply

19 mikaere66 April 1, 2013 at 7:17 pm

Hi esritter … I’m relatively new to Linux, so I don’t understand your alias. Can you please explain?

Reply

20 Babu June 12, 2012 at 3:33 am

Like it ! Thanks.

Reply

21 Honeypuck June 12, 2012 at 3:39 am

Nice commands!
In case you would like to be shown the contents of a directory immediately after moving to it by cd DIRECTORY you could define the following function in .bashrc:

cdl()    {
  cd"$@";
  ls -al;
}
You can modify the options of ls to meet your needs of course. Next time you switch directories on the command line with 'cdl DIRECTORY' it will automatically execute the command 'ls -al', displaying all subdirectories and files (hidden ones as well when setting the option -a). I hope this will be useful for someone. In case you like the alias, do not forget to change
alias ..='cd ..'
to
alias ..='cdl ..'

Reply

22 Rishi G June 12, 2012 at 4:01 am

Here are 4 commands i use for checking out disk usages.

#Grabs the disk usage in the current directory
alias usage='du -ch | grep total'
#Gets the total disk usage on your machine
alias totalusage='df -hl --total | grep total'
#Shows the individual partition usages without the temporary memory values
alias partusage='df -hlT --exclude-type=tmpfs --exclude-type=devtmpfs'
#Gives you what is using the most space. Both directories and files. Varies on
#current directory
alias most='du -hsx * | sort -rh | head -10'

Reply

23 shadowbq December 17, 2012 at 2:08 pm

usage is better written as

alias usage=’du -ch 2> /dev/null |tail -1′

Reply

24 Mark January 12, 2013 at 6:08 pm

Thank you all for your aliases.
I found this one long time ago and it proved to be useful.

# shoot the fat ducks in your current dir and sub dirs
alias ducks=’du -ck | sort -nr | head’

Reply

25 James C. Woodburn June 12, 2012 at 11:45 am

I always create a ps2 command that I can easily pass a string to and look for it in the process table. I even have it remove the grep of the current line.

alias ps2=’ps -ef | grep -v $$ | grep -i ‘

Reply

26 Juanma June 12, 2012 at 12:45 pm

Nice post. Thanks.
@oll & Vivek: I’m sure you know this, but to leave trace of it in this page I’ll mention that, at least in Bash, you have functions as a compromise between aliases and scripts. In fact, I solved a similar situation to what is described in #7 with a function:
I keep some files under version control, hard-linking to those files into a given folder, so I want find to ignore that folder, and I don’t want to re-think and re-check how to use prune option every time:

function f {
	arg_path=$1 && shift
	find $arg_path -wholename "*/path-to-ignore/*" -prune -o $* -print
}

Reply

27 hhanff June 12, 2012 at 2:15 pm

# This will move you up by one dir when pushing AltGr .
# It will move you back when pushing AltGr Shift .
bind ‘”…”:”pushd ..\n”‘ # AltGr .
bind ‘”÷”:”popd\n”‘ # AltGr Shift .

Hendrik

Reply

28 Bill C. June 12, 2012 at 4:58 pm

One more thing to keep in mind is the difference in syntax between shells. I used to work on a system that used HP-UX and Sun Solaris, and the alias commands were different. One system used
alias ll=’ls -l’
and the other one (I can’t remember which was which, sorry) was
alias ll ‘ls -l’

Something to be aware of!

Thanks for this article and the site, V! Keep ‘em coming!

Reply

29 old486whizz June 12, 2012 at 5:16 pm

I would use a function for df:
df () {
if [[ "$1" = "-gt" ]]; then
x=”-h”
shift
x=$x” $@”
fi
/bin/df $x -P |column -t
}

That way you can put “df -k /tmp” (etc).
… I work with AIX a lot, so often end up typing “df -gt”, so that’s why the if statement is there.

I also changed “mount” to “mnt” for the column’s:
alias mnt=”mount |column -t”

Reply

30 Art Protin June 12, 2012 at 9:53 pm

Any alias of rm is a very stupid idea (except maybe alias rm=echo fool).

A co-worker had such an alias. Imagine the disaster when, visiting a customer site, he did “rm *” in the customer’s work directory and all he got was the prompt for the next command after rm had done what it was told to do.

It you want a safety net, do “alias del=’rm -I –preserve_root’”,

Reply

31 Opt June 13, 2012 at 12:22 am

Great post I’ve been looking for something like this I always tend to go about things the long way round. With these alias and some shell scripting I’m really starting to cut down on wasted time!

Thanks again!

Reply

32 Blue Thing June 13, 2012 at 6:19 am

I use this one when I need to find the files that has been added/modified most recently:

alias lt=’ls -alrt’

Reply

33 tef June 14, 2012 at 4:56 pm
# file tree
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
#turn screen off
alias screenoff="xset dpms force off"
# list folders by size in current directory
alias usage="du -h --max-depth=1 | sort -rh"
# e.g., up -> go up 1 directory
# up 4 -> go up 4 directories
up()
{
    dir=""
    if [[ $1 =~ ^[0-9]+$ ]]; then
        x=0
        while [ $x -lt ${1:-1} ]; do
            dir=${dir}../
            x=$(($x+1))
        done
    else
         dir=..
    fi
    cd "$dir";
}

Reply

34 tef June 14, 2012 at 7:38 pm

might be a repost, oops

# ganked these from people
#not an alias, but I thought this simpler than the cd control
#If you pass no arguments, it just goes up one directory.
#If you pass a numeric argument it will go up that number of directories.
#If you pass a string argument, it will look for a parent directory with that name and go up to it.
up()
{
    dir=""
    if [ -z "$1" ]; then
        dir=..
    elif [[ $1 =~ ^[0-9]+$ ]]; then
        x=0
        while [ $x -lt ${1:-1} ]; do
            dir=${dir}../
            x=$(($x+1))
        done
    else
        dir=${PWD%/$1/*}/$1
    fi
    cd "$dir";
#turn screen off
alias screenoff="xset dpms force off"
#quick file tree
alias filetree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"

Reply

35 em June 20, 2012 at 5:31 am

a little mistake, not really important if you don’t copy/paste like a dumbass :-)

alias iptlistfw=’sudo /sbin/iptables -L FORWORD -n -v –line-numbers’

it is “FORWARD”, not “FORWORD”

Reply

36 Vivek Gite June 20, 2012 at 6:34 am

@em

Thanks for the heads up.

Reply

37 nishanth July 20, 2012 at 4:38 am

In “Task: Disable an alias temporarily (bash syntax)”

## path/to/full/command

/usr/bin/clear

## call alias with a backslash ##

\c ===> This should be \clear right?

Reply

38 Biocyberman October 22, 2012 at 9:07 am

No.

Previously he set the alias:
alias c=’clear’
so \c is correct.

Reply

39 O-Deka-K March 12, 2013 at 3:34 pm

True, but unless you have a program called ‘c’, this doesn’t do anything useful. The example doesn’t really illustrate the point. This one is better:

## Interactive remove
alias rm='rm -i'
## Call the alias (interactive remove)
rm
## Call the original command (non-interactive remove)
\rm

Reply

40 kioopi November 26, 2012 at 9:55 am
alias tgrep='rgrep --binary-files=without-match'
alias serve='python -m SimpleHTTPServer'

Reply

41 Mac Maha November 27, 2012 at 9:58 am

I used it this way.
I added myself to visudo file with nopasswd privileges.
so that I don’t have to type password when I do “sudo su -”.
Then created alias root=’sudo su -’
This enables me to log in to root with just “root”.

by the ways the article is very helpful for everyone who works on linux servers or desktops on everyday basis.
Regards,
Mac Maha.

Reply

42 Larry Helms December 2, 2012 at 11:00 pm

I move across various *nix type OSes. I have found that it’s easiest to keep my login stuff (aliases & environment variables) in separate files as in .aliases-{OS}. E.g.:

$HOME/.aliases-darwin
$HOME/.aliases-linux

All I have to do then in .bashrc, or .profile, whatever is do this:

OS=$( uname | tr '[:upper:]' ':[lower:]')
. $HOME/.aliases-${OS}
. $HOME/.environment_variables-${OS}

and/or

for SCRIPT in $( ls -1 $HOME/scripts/login/*-${OS} )
do
  . ${SCRIPT}
done

Reply

43 EW1(SG) January 1, 2013 at 3:38 pm

And Larry wins the thread going away!

Reply

44 Martin December 4, 2012 at 9:31 am

i have 2 more that haven’t been posted yet:

helps with copy and pasting to and from a terminal using X and the mouse. (i chose the alias name according to what the internet said the corresponding macos commands are.)

alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'

and something I use rather frequently when people chose funny file/directory names (sad enough):

chr() {
  printf \\$(printf '%03o' $1)
}
ord() {
  printf '%d' "'$1"
}

Reply

45 Martin December 4, 2012 at 9:33 am

edit:
the pb* aliases are especially for piping output to the clipboard and vice versa

Reply

46 Tom December 20, 2012 at 2:18 pm

That was a great list. Here are some of mine:

I use cdbin to cd into a bin folder that is many subdirectories deep:

alias cdbin='cd "/mnt/shared/Dropbox/My Documents/Linux/bin/"'

I can never remember the sync command.

alias flush=sync

I search the command history a lot:

alias hg='history|grep '

My samba share lives inside a TrueCrypt volume, so I have to manually restart samba after TC has loaded.

alias restsmb='sudo service smb restart'

I’m surprised that nobody else suggested these:

alias syi='sudo yum install'
alias sys='sudo yum search'

Reply

47 zork January 16, 2013 at 4:59 pm

I find these aliases are helpful

alias up1="cd .."
# edit multiple files split horizontally or vertically
alias   e="vim -o "
alias   E="vim -O "
# directory-size-date (remove the echo/blank line if you desire)
alias dsd="echo;ls -Fla"
alias   dsdm="ls -FlAh | more"
# show directories only
alias   dsdd="ls -FlA | grep :*/"
# show executables only
alias   dsdx="ls -FlA | grep \*"
# show non-executables
alias   dsdnx="ls -FlA | grep -v \*"
# order by date
alias   dsdt="ls -FlAtr "
# dsd plus sum of file sizes
alias   dsdz="ls -Fla $1 $2 $3 $4 $5  | awk '{ print; x=x+\$5 } END { print \"total bytes = \",x }'"
# only file without an extension
alias noext='dsd | egrep -v "\.|/"'
# send pwd to titlebar in puttytel
alias   ttb='echo -ne "33]0;`pwd`07"'
# send parameter to titlebar if given, else remove certain paths from pwd
alias   ttbx="titlebar"
# titlebar
if [ $# -lt 1 ]
then
    ttb=`pwd | sed -e 's+/projects/++' -e 's+/project01/++' -e 's+/project02/++' -e 's+/export/home/++' -e 's+/home/++'`
else
    ttb=$1
fi
echo -ne "33]0;`echo $ttb`07"
alias machine="echo you are logged in to ... `uname -a | cut -f2 -d' '`"
alias info='clear;machine;pwd'

Reply

48 Tom Hand January 18, 2013 at 5:47 am

A couple you might mind useful.

alias trace='mtr --report-wide --curses $1'
alias killtcp='sudo ngrep -qK 1 $1 -d wlan0'
alias usage='ifconfig wlan0 | grep 'bytes''
alias connections='sudo lsof -n -P -i +c 15'

Reply

49 nyuszika7h February 7, 2013 at 4:43 pm

You should check $EUID, not $UID, because if the effective user ID isn’t 0, you aren’t root, but if the real/saved user UID is 0, you can seteuid(0) to become root.

Reply

50 nyuszika7h February 7, 2013 at 4:47 pm

Reply to Tom (#42):

(1) Using `hg’ for `history –grep’ is probably not a good idea if you’re ever going to work with Mercurial SCM.

(2) Using sudo for `yum search’ is entirely pointless, you don’t need to be root to search the package cache.

Reply

51 Karthik February 14, 2013 at 10:12 am
alias up1="cd .."
# edit multiple files split horizontally or vertically
alias   e="vim -o "
alias   E="vim -O "
# directory-size-date (remove the echo/blank line if you desire)
alias dsd="echo;ls -Fla"
alias   dsdm="ls -FlAh | more"
# show directories only
alias   dsdd="ls -FlA | grep :*/"
# show executables only
alias   dsdx="ls -FlA | grep \*"
# show non-executables
alias   dsdnx="ls -FlA | grep -v \*"
# order by date
alias   dsdt="ls -FlAtr "
# dsd plus sum of file sizes
alias   dsdz="ls -Fla $1 $2 $3 $4 $5  | awk '{ print; x=x+\$5 } END { print \"total bytes = \",x }'"
# only file without an extension
alias noext='dsd | egrep -v "\.|/"'
# send pwd to titlebar in puttytel
alias   ttb='echo -ne "33]0;`pwd`07"'
# send parameter to titlebar if given, else remove certain paths from pwd
alias   ttbx="titlebar"
# titlebar
if [ $# -lt 1 ]
then
    ttb=`pwd | sed -e 's+/projects/++' -e 's+/project01/++' -e 's+/project02/++' -e 's+/export/home/++' -e 's+/home/++'`
else
    ttb=$1
fi
echo -ne "33]0;`echo $ttb`07"
alias machine="echo you are logged in to ... `uname -a | cut -f2 -d' '`"
alias info='clear;machine;pwd'

Reply

52 John Ko February 15, 2013 at 10:57 pm

I’m surprised no one has mentioned:
alias ls=’ls -F’
It will show * after executables, / after directories and @ after links.

Reply

53 zork March 25, 2013 at 6:03 pm

John (Ko),

The variations of dsd that I gave all include -F

Give them a try.

Reply

54 John Ko February 15, 2013 at 11:01 pm

And for you vi(m) lovers out there, in my .bashrc:
set -o vi

esc j,k for searching history using vi semantics. edit line using w, dw, b, F or whatever other as if in vi. Occasionally need to watch that if in command mode, need to press i first so you can actually go back to inserting as opposed to not seeing anything as you attempt to type.
set -o emacs
to get back out of this mode if you want to restore it what others have used.

Reply

55 Erin February 16, 2013 at 7:44 am

Here are some tidbits I’ve setup to help troubleshoot things quickly

This one pings a router quickly

alias pr=”ping \`netstat -nr| grep -m 1 -iE ‘default|0.0.0.0′ | awk ‘{print \$2}’\`”

This export puts the current subnet as a variable (assuming class C) for easy pinging or nmaping

export SN=`netstat -nr| grep -m 1 -iE ‘default|0.0.0.0′ | awk ‘{print \$2}’ | sed ‘s/\.[0-9]*$//’ `
ping $SN.254
nmap -p 80 $SN.*

This command which I just named ‘p’ will call ping and auto populate your current subnet. You’d call it like this to ping the router p 1

#!/bin/bash
[ "$#" -eq 1 ] || exit “1 argument required, $# provided”
echo $1 | grep -E -q ‘^[0-9]+$’ || exit “Numeric argument required, $1 provided”
export HOST=$1
export SUBNET=`netstat -nr| grep -m 1 -iE ‘default|0.0.0.0′ | awk ‘{print \$2}’`
export IP=`echo $SUBNET | sed s/\.[0-9]*$/.$HOST/`
ping $IP

Quickly reload your .bashrc or .bash_profile

alias rl=’. ~/.bash_profile’

Reply

56 Flack February 22, 2013 at 8:44 pm

Clear xterm buffer cache

alias clearx="echo -e '/0033/0143'"

Contrary to the clear command that only cleans the visible terminal area. AFAIK It’s not an universal solution but it worths a try.

Edited by Admin as requested by OP.

Reply

57 Eduard Seifert February 23, 2013 at 6:44 pm

alias clear=’printf “33c”‘

Reply

58 Eduard Seifert February 23, 2013 at 6:44 pm
alias clear='printf "33c"'

Reply

59 DarrinMeek February 26, 2013 at 3:11 am

I have been using this concept for many years and still trying to perfect the methodology. My goals include minimal keystrokes and ease of use. I use double quotes in my alias defn even though single quote delimiters are the normal convention. I use ‘aa’ for “add alias.” It is always the first alias I create. Each job and each environ begin with ‘aa’ alias creation. My aliases have evolved into productized command line interfaces and have been adopted by many others over the years. http://www.iboa.us/iboaview.html

Reply

60 muratkarakus March 1, 2013 at 5:02 pm

Nowadays, git is so popular, we can not miss it
These are my git aliases

alias g=”git”
alias gr=”git rm -rf”
alias gs=”git status”
alias ga=”g add”
alias gc=”git commit -m”
alias gp=”git push origin master”
alias gl=”git pull origin master”

Reply

61 muratkarakus March 1, 2013 at 6:16 pm

alias sd=”echo michoser | sudo -S”

alias ai=”sd apt-get –yes install”
alias as=”apt-cache search”
alias ar=”sd apt-get –yes remove”

alias .p=”pushd .”
alias p.=”popd”

Reply

62 Tolli March 2, 2013 at 8:35 pm

Regarding the cd aliases (#2), you can use the autocd bash option (run ‘shopt -s autocd’) to change directories without using cd. Then, you can just type ‘..’ to go up one directory, or ‘../..’ to go up 2 directories, or type the (relative) path of any directory to go to it. Another trick is to set the CDPATH environment variable. This will let you easily change to directories in a commonly used sub-directories such as your home directory. For example, if you set the CDPATH to ‘.:$HOME’ (run ‘export CDPATH=.:$HOME’), then run ‘cd Documents’ you will change directories to the Documents/ directory in your home directory, no matter what directory you are currently in (unless your current directory also has a documents/ directory in it).

Reply

63 Chris F.A. Johnson March 11, 2013 at 6:14 pm

I don’t use aliases. As the bash man page says:

“For almost every purpose, aliases are superseded by shell functions.”

At the top of my .bashrc I have ‘unalias -a’ to get rid of any misguided aliases installed by /etc/profile.

Reply

64 griswolf March 11, 2013 at 7:24 pm

The aliases that I use the most (also a lot of shell functions):
alias j=’jobs -l’
alias h=’history’
alias la=’ls -aF’
alias lsrt=’ls -lrtF’
alias lla=’ls -alF’
alias ll=’ls -lF’
alias ls=’ls -F’
alias pu=pushd
alias pd=popd
alias r=’fc -e -’ # typing ‘r’ ‘r’epeats the last command

Reply

65 RajaSekhar April 2, 2013 at 2:56 am

Useful alias. Thanks mates.

I find the following useful too

alias tf='tail -f '
# grep in *.cpp files
alias findcg='find . -iname "*.cpp" | xargs grep -ni --color=always '
# grep in *.cpp files
alias findhg='find . -iname "*.h" | xargs grep -ni --color=always '
#finds that help me cleanup when hit the limits
alias bigfiles="find . -type f 2>/dev/null | xargs du -a 2>/dev/null | awk '{ if ( \$1 > 5000) print \$0 }'"
alias verybigfiles="find . -type f 2>/dev/null | xargs du -a 2>/dev/null | awk '{ if ( \$1 > 500000) print \$0 }'"
#show only my procs
alias psme='ps -ef | grep $USER --color=always '

Reply

66 Carsten April 5, 2013 at 1:06 pm

Very nice alias list.
Here’s another very handy alias:

alias psg='ps -ef | grep'

ex: looking for all samb processes:

psg mbd

Reply

67 phillip April 6, 2013 at 6:23 am

Here is the most important alias:

alias exiy=’exit’

Reply

68 Thilo Six April 8, 2013 at 2:20 pm

I did learn some new things. Thanks for that.

Regarding:
# Do not wait interval 1 second, go fast #
alias fastping=’ping -c 100 -s.2′

From reading the man page i gather the ‘-s’ should be ‘-i’ instead.

ping(8):
-s packetsize
Specifies the number of data bytes to be sent.

-i interval
Wait interval seconds between sending each packet. The
default is to wait for one second between each packet
normally, or not to wait in flood mode. Only super-user
may set interval to values less 0.2 seconds.

Reply

69 Thomas April 9, 2013 at 3:44 pm

Back Up [function, not alias] – Copy a file to the current directory with today’s date automatically appended to the end.

bu() { cp $@ $@.backup-`date +%y%m%d`; }

Add to .bashrc or .profile and type: “bu filename.txt”
-
I made this a long time ago and use it daily. If you really want to stay on top of your backed up files, you can keep a log by adding something like:

bu() { cp $@ $@.backup-`date +%y%m%d`; echo "`date +%Y-%m-%d` backed up $PWD/$@" >> ~/.backups.log; }

I hope someone finds this helpful!

Reply

70 ahmed April 21, 2013 at 1:03 am

i did!
thanks a lot

Reply

71 Russ Thompson April 25, 2013 at 2:34 am

I am learning to love simple functions in .bashrc

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

But the great aliases are in the cmd prompt under windoze:

run doskey /macrofile=\doskey.mac

then set up a doskey,mac in root directory with the CORRECT commands

ls=dir $* /o/w
cat=type $*
rm=del $*
lsl=dir $* /o/p
quit=exit

yes, I have to work in the sludgepit, but I can fix the command set

Reply

72 Andrew May 1, 2013 at 8:44 pm

Since I work in a number of different distributions, I concatenated 17 and 18:

case $(lsb_release -i | awk ‘{ print $3 }’) in
Ubuntu|Debian)
alias apt-get=”sudo apt-get”
alias updatey=”sudo apt-get –yes”
alias update=’sudo apt-get update && sudo apt-get upgrade’
;;
CentOS|RedHatEnterpriseServer)
alias update=’yum update’
alias updatey=’yum -y update’
;;
esac

Of course you could add Fedora, Scientific Linux, etc, to the second one, but I don’t have either of those handy to get the output of lsb_release.

Reply

73 Aaron Goshine May 5, 2013 at 3:27 am

alias gtl=’git log’
alias gts=’git status’

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 13 + 7 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Tagged as: , , , , , , , , , , , , , , , , , ,

Previous post:

Next post: