Linux Commands Examples

A great documentation place for Linux commands


Sorry, no description

... the author of this command may not have provided any manuals

Once you know what this command is about, feel free to add a description in the input "add an example + trick and tips" below
 help other Linux-fans !

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



What does "network" mean in the /etc/network/interfaces file?

For your case, network is, which means your ip address is in the network range, to

You can always get your network base address easily by doing ip & mask, where & is logical AND.

According to the bash man page, "For almost every purpose, aliases are superseded by shell functions."
example added by Chris F.A. Johnson
In my ~/.bashrc file, I have added the following function :

function k(){

 ps aux | grep $1 | tr -s ' ' | cut -f2 -d" " | xargs kill -9



k <name of software>

k firefox # kills all instances of firefox, including some processes that are related

k netbeans # kills all instances of netbeans

nice and useful "alias" !!
example added by LeBerger
Aliases are a Csh-based, rather limited option allowing a single-line command to be saved as a type of reusable macro within a given shell instance (note that users of Bourne shell derivatives should almost always use the function facility of those shells by preference, even though aliases are supported in a few like Bash) Complex aliases could be constructed in Csh by chaining them together to work around the inability to include most types of shell flow control construct.

alias rm 'ls -Fsd \!*; echon "remove? "; if ("`head -1`" == "y") /bin/rm \!*'

Aliases like this were typically stored in the ~/.cshrc file.

## What does it do ?

This rm alias masks "rm" with a safer variant that will prompt for confirmation of *all* deletions together before removing any files, a more robust and less annoying approach than using "rm -i", especially since the latter tends to train users to type "rm *" - a very bad habit to have.

## Output

% touch a b c
% rm -i a b c
rm: remove regular empty file `a'? y
rm: remove regular empty file `b'? y
rm: remove regular empty file `c'? y
% touch a b c
% alias rm 'ls -Fsd \!*; echon "remove? "; if ("`head -1`" == "y") /bin/rm \!*'
% rm a b c
0 a  0 b  0 c
remove? y
example added by Alex
echo "alias rm='rmi'"
alias st='subl'
alias stt='subl .'
alias g='git'
alias gs='git status'
alias l='ls'
alias u='cd ..'
alias uu='cd ../..'
alias uuu='cd ../../..'
alias uuuu='cd ../../../..'
alias sl='ls'
alias vf='cd'
alias xs='cd'
alias ks='ls'
alias ecgi='echo'

IP address alias assigned by DHCP

Using static or DHCP assigned IP addresses is a choice you make for your computer.

There is a good tutorial here.

It contains plenty of detail, and helps you avoid problems that you can have if you use static instead of DHCP assigned address, e.g. how to connect to DNS servers and gateways.


error when using commandline as a bash alias on linux

Since the alias is defined within double quotes, the date command gets executed at the time of definition of the alias, and the $1 variables get expanded too. You can check this by looking up the alias after you define it:

$ alias downloads="grep  `date '+%d/%b/%Y'` access.logs  | egrep |awk '{print $1, $4, $5, $7, $8, $9, $10}' | sort |uniq -c -w15 |sort -n"
$ alias downloads
alias downloads='grep  27/Sep/2009 access.logs  | egrep |awk '\''{print , , , , , , 0}'\'' | sort |uniq -c -w15 |sort -n'

You should be able to fix this by escaping the date call and the $1 variables:

$ alias downloads="grep  \`date '+%d/%b/%Y'\` access.logs  | egrep |awk '{print \$1, \$4, \$5, \$7, \$8, \$9, \$10}' | sort |uniq -c -w15 |sort -n"
$ alias downloads
alias downloads='grep  `date '\''+%d/%b/%Y'\''` access.logs  | egrep |awk '\''{print $1, $4, $5, $7, $8, $9, $10}'\'' | sort |uniq -c -w15 |sort -n'

Check if you're able to run this successfully. Ideally, you'd define the alias in single-quotes, but the presence of single quotes within the alias itself makes that tricky in your situation.


How enter in folder with one command?

Try replacing "'s (quote) with ''s (single-quote) instead.

Also, make sure you reload your .bashrc either by starting a new terminal emulator window, or by doing . .bashrc in your home folder.


In Ubuntu, routes are not added as defined in rc.local file....why?

rc.local is not the best place to set up additional NIC aliases and routes.

Just use /etc/network/interfaces for that.

NIC alias example

static routes example

Concerning your problem:

you use an absolute path to the ifconfig tool, but a relative path to the ip tool. Try using an absolute path there too. Find it by using which ip or whereis ip.


Aliases in subshell / child process

Aliases are not inherited. That's why they are traditionally set in bashrc and not profile. Source your from your .bashrc or the system-wide one instead.


ssh: add "-X" to default options

You need the ~/.ssh/config file ForwardX11 or ForwardX11Trusted options.

Specifically, if you want to add -X to every invocation of ssh, put something like this in your config file:

ForwardX11 yes

If you want to use if only for certain hosts, you need to set up a host specification for each host:

Host <hostname>
  ForwardX11 yes

Check out the man page for ssh_config and ssh for more details.


Command to search programs in Linux

which does exactly that:

which commandname

Is this alias any useful?

This mailing list archive shows the subtle differences between the two that existed in 1996. Not sure if they still exist now, but since you mentioned an old file...

Basically, cwd only prints out where csh thinks it is, instead of the absolute path that pwd will figure out.

To quote Scott Williamson in that thread:

Yes, the difference is that $cwd will give you the path that the shell took to get to that directory because it doesn't know any better. pwd will give the real physical directory because it starts at the current directory and works back up the hierarchy. So symbolic links and mounting or re-mounting directories will confuse $cwd.


How to change default vi alias in Fedora 14?

Aliases added to bashrc don't take effect immediately. You have to restart your terminal session or logout and log back in.

To make the alias take effect immediately, run the alias line you added on a terminal as if it were a command or source your bashrc as Nitrodist explains in the first comment.


How to make an alias to a part of a block device

Use addpart (from util-linux) to tell the kernel about partitions on a device.

   addpart device partition start length

   addpart is a program that informs the Linux kernel of new par?

   This command doesn't manipulate partitions on hard drive.

How to make alias shortcuts for terminal work as root or as exec?

Alias a command to itself, and end the alias with a space:

alias exec="exec "
alias sudo="sudo "
alias tsocks="tsocks "

With this, bash will automatically expand tsocks findip ? tsocks wget -q ...

As seen in bash's documentation:

$ help alias
alias: alias [-p] [name[=value] ... ]
    A trailing space in VALUE causes the next word to be checked for
    alias substitution when the alias is expanded.

This, however, is not related to being root (unless you were talking about sudo usage), and cannot be done at exec() syscall level (aliases are entirely internal to bash).


Ubuntu - Create a link to a specified directory so I can easily change to that directory

If you put a link in your home directory you can do

$ cd ~/myapp

It means typing two extra characters, but it'll work.

Or you could use environment variables and do

$ cd $MYAPP

get value of an alias in bash

Bash stores its list of aliases in the associative array BASH_ALIASES. The equivalent of sudo `alias netstat` is then sudo ${BASH_ALIASES[netstat]}. However, I would suggest the following instead, which works with builtin shell commands and deals correctly with quoting:

sudo bash -c "${BASH_ALIASES[netstat]}"

There's still a lot that won't work with this, like e.g. nested aliases.

How can this site be more helpful to YOU ?

give  feedback