Tag Info

Hot answers tagged


To create an alias permanently add the alias to your .bashrc file gedit ~/.bashrc And then add your alias at the bottom. Now execute . ~/.bashrc in your terminal (there should be a gap between the . and ~/.bashrc. Now you can check your alias.


Add the following line to your ~/.bashrc: alias sudo='sudo ' From the bash manual: Aliases allow a string to be substituted for a word when it is used as the first word of a simple command. The shell maintains a list of aliases that may be set and unset with the alias and unalias builtin commands. The first word of each simple command, if ...


The type builtin is useful for this. It will not only tell you about aliases, but also functions, builtins, keywords and external commands. $ type ls ls is aliased to `ls --color=auto' $ type rm rm is /bin/rm $ type cd cd is a shell builtin $ type psgrep psgrep is a function psgrep () { ps -ef | { read -r; echo "$REPLY"; grep ...


There are lot of ways to create alias . The most used ways are : 1) . Add aliases directly in your ~/.bashrc file For example. append these line to ~/.bashrc file alias ll='ls -l' alias rm='rm -i' Next time when you type rm the rm -i command will be executed. 2). The second method lets you make a separate aliases file, so you won't have to put them ...


The command to remove an alias is unalias so.... unalias gs Manual: NAME unalias - remove alias definitions SYNOPSIS unalias alias-name... unalias -a DESCRIPTION The unalias utility shall remove the definition for each alias name specified. See Alias Substitution . The aliases shall be removed from the current ...


You can bypass aliases by the following methods: the full pathname of the command: /bin/ls command substitution: $(which ls) the command builtin: command ls double quotation marks: "ls" single quotation marks: 'ls' a backslash character: \ls


In Ubuntu, the default .bashrc skeleton file looks for a .bash_aliases file in your home directory when you log in and sources it. So if you just create a .bash_aliases file and put any aliases you want in it, it should be sourced automatically when you open a new bash shell (no need to log out of desktop and back in, just open a new terminal). Here's the ...


Just type alias while at the Shell prompt. It should output a list of all currently-active aliases. Or, you can type alias [command] to see what a specific alias is aliased to, as an example, if you wanted to find out what the ls alias was aliased to, you could do alias ls.


From Bash Tips and Tricks: 'cd' with style: Finally, I want to show you how to write your own custom replacement for the 'cd' command. Do you find yourself always typing the same thing upon changing into a directory? You probably at least list the files there every time, perhaps so much that your hands automatically type 'ls' after every 'cd'. ...


In your shell script use the full path rather then an alias. In your shell script, set a variable, different syntax petsc='/home/your_user/petsc-3.2-p6/petsc-arch/bin/mpiexec` $petsc myexecutable Use a function in your script. Probably better if petsc is complex function petsc () { command 1 command 2 } petsc myexecutable Source your aliases ...


I really like Ctrl+Alt+E as I learned from this answer. It "expands" the currently typed command line, meaning it performs alias expansion (amongst other things). What does that mean? It turns any alias, that might be currently written on the command line, into what the alias stands for. For example, if I type: $ ls and then press Ctrl+Alt+E, it is ...


Sure, although I have never tried it as an alias but it should work: sudo apt-get update && sudo apt-get -y upgrade


Alias are deprecated in favor of shell functions. From bash manual page: For almost every purpose, aliases are superseded by shell functions. To create a function, and export it to subshells, put the following in your ~/.bashrc: petsc() { ~/petsc-3.2-p6/petsc-arch/bin/mpiexec "$@" } export -f petsc Then you can freely call your command from your ...


If you want to check something in bash, use type and man. In your case you want to know what is . $ type . . is a shell builtin shell builtin means that . is inside bash shell. You can find information about shell builtins in bash manual page. There is a big section SHELL BUILTIN COMMANDS $ man bash SHELL BUILTIN COMMANDS Unless otherwise ...


With most commands, you can pass -- as an argument, and all subsequent arguments are treated as operands and not options, even if they begin with a dash. The alias builtin in bash recognizes --. alias -- -='cd -'


Use a function instead of an alias: cs() { cd "$1" && ls; }


While the other answers offer a good workaround for your problem, to answer your question, the right way to use an alias inside a .desktop file is, in your case: Exec=bash -ic "midos" That's because aliases from ~/.bashrc file will work only in a bash interactive shell (-i option is used in this case to start bash interactive). If another user wants to ...


Instead of using grep, you can just type alias aliasname to see what an alias is set to. For example, alias ls will return ls='ls --color=auto'. Also take a look at the type and whence commands, which return more detailed information about utilities, including executable files in your path, shell built-ins, aliases, and shell functions.


You can use the builtin command in bash : function cd() { new_directory="$*"; if [ $# -eq 0 ]; then new_directory=${HOME}; fi; builtin cd "${new_directory}" && ls }


You can't use slashes in an alias name. Bash allows them in function names, however, so you can make that a function: cd../.. () { cd ../..; } You can't use backslashes in an alias or function name. The backslash character quotes the next character, so cd..\.. is parsed as cd...., well before that string is looked up as a command name. If you want to call ...


DON'T CD, just run it using its absolute path This version: cd /home/path_to_x && ./x changes directory to an absolute path (you see how /home/... starts at the root directory) and then runs the executable at the relative path ./x (that is, relative to the new working directory). This version: ./home/path_to_x/x tries to run the executable at ...


alias new_name='old command' For creating a permanent alias you've to edit the .bashrc file in youre home dir. More info here More .bashrc files here


You can do it, but only if your directory names don't contain several consecutive spaces, and only if they contain no shell special character other than spaces. cd () { builtin cd "$*"; } In practice, use completion: type cd My then press Tab. Bash will insert backslashes before special characters.


Here are some that I like: #Opens current directory in a file explorer alias explore='nautilus .' #Opens current directory in a file explorer with super user privileges alias suexplore='sudo nautilus .' #Opens current directory in Ubuntu's Disk Usage Analyzer GUI with super user privileges in the background alias analyze='gksudo baobab . &' #Opens a ...


The problem is that you are trying to execute a non executable file: You can check this with: ls -la ~/.bashrc -rw-r--r-- 1 username username 3596 2010-08-05 17:17 /home/pt001424/.bashrc Note there is no "x - executable" letter on the first column (file permissions). Profile files are not executable files, instead of executing them you load them with: ...


With the first method you are not creating an alias, you are creating a symlink. Symlinks are short for symbolic links: Symbolic links are files that act as pointers to other files. [...] A symbolic link is a special type of file whose contents are a string that is the pathname another file, the file to which the link refers. In other ...


You can set this option in one f the mplayer option files, this will then be the default behaviour. For system wide change /etc/mplayer/mpplayer.conf of just for that user create ~/.mplayer/mplayer.conf and put it in there. Adding this to ~/.mplayer/mplayer.conf works: msglevel=all=0


Actually both ls and l are equal raja@badfox:~/Pictures$ l des.png Screenshot from 2012-09-22 19:37:03.png Screenshot from 2012-09-22 19:37:11.png Screenshot from 2012-09-22 19:37:12.png Untitled.png raja@badfox:~/Pictures$ ls des.png Screenshot from 2012-09-22 19:37:03.png Screenshot from 2012-09-22 19:37:11.png Screenshot from 2012-09-22 19:37:12.png ...


l is an alias for ls -CF, which behaves differently from plain ls. -C -C makes ls print output in column form. When stdout is a terminal (rather than being redirected to a file or non-terminal device, or piped to another command), -C is implied. So running ls -C is the same as running ls. But they are not equivalent when ls is redirected or piped. For ...


aliases do not support the positional parameters so you need to create a function (in ~/.profile) and alias that function. function grepMe(){ grep "$1" ~/myfile } and then alias it.. alias grepAlias="grepMe"

Only top voted, non community-wiki answers of a minimum length are eligible