# Tag Info

62

Not many people seem to know about it, but you can use the doskey built-in macro tool, the only issue is that it doesn't save. There are many ways to work around this though. usage: doskey ls=dir ls will now do a directory listing just like dir would. If you want to use arguments with the commands, use this syntax: doskey d=dir $* As for the ... 26 It's a simple as: Create a file with aliases, e.g. c:\bin\aliases: ls=dir /ONE$* cd=cd /d $* python=python -ic "" ps=tasklist$* kill=taskkill /IM $* Create a file with all the stuff you want to run when cmd.exe is started, including loading the aliases with doskey e.g. c:\bin\cmd_autoruns.cmd: @echo off cls color 0A doskey /macrofile=c:\bin\aliases ... 26 You can press Ctrl-Alt-e to perform the readline function shell-expand-line which will do alias, history and word expansions. Note that on some keyboards Meta is not Alt. You might need to press Esc then Ctrl-e The functions alias-expand-line and history-and-alias-expand-line are not bound by default, but you can bind them by adding lines similar to the ... 24 It is rather easy to setup permanent aliases in the Windows command prompt using the @DOSKEY command and HKCU\Software\Microsoft\Command Processor Autorun option. Quick step-by-step guide: Create a new batch file, call it Alias.bat. Copy/paste the text below. TIP: I recommend creating a C:\Bin folder for all your command line tools. Open the register ... 15 Vim 'ignores' your aliases because your shell is not in a 'mood' to parse your .bash_profile/.bashrc (you did not specify, where your aliases are defined) because it is not started as a login/interactive shell (read here to find out more about what is read when and for what reason). So, you have several options: Put the code you use in your pdflatex alias ... 12 From the alias man page: The first word of each simple command, if unquoted, is checked to see if it has an alias. If so, that word is replaced by the text of the alias. The alias name and the replacement text may contain any valid shell input, including shell metacharacters, with the exception that the alias name may not contain ='. ... 10 Just to be clear, I'm basing this on the assumption that you really do want http://local.example.com to load the literal web page http://localhost/path/to/example.com. In other words, this will only work for this machine. If, on the other hand, you're trying to serve web pages to the outside world using your Mac OS X machine, then that's a different ... 9 This is only possible if the two DHCP clients use different MAC addresses. Which means they cannot run both on the same physical network interface, which has a single MAC address. The solution is Linux's virtual MAC-VLAN network interfaces. MAC-VLAN interfaces are virtual network interfaces backed by a physical interface, but using with a different MAC ... 8 The tilde is not an alias, it's part of bash's shell expansion (just like *.txt or$((1 + 2))). Bash tilde expansion supports the following tilde-prefixes: ~ The value of $HOME ~/foo$HOME/foo ~fred/foo The subdirectory foo of the home directory of the user fred ~+/foo $PWD/foo ~-/foo${OLDPWD-'~-'}/foo ~N ...

7

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 ...

7

You can probably create an alias for that. Assuming you are using Bash, create a .bash_aliases file in your Home directory, if it already doesn't exist. Then, add a line with the following to the file: alias apt='sudo apt-get' Now close the shell and reopen it again. Now you can install any new package with the syntax apt install <package-name>. ...

7

This is what your PATH environment variable is for. Arrange your PATH environment variable so that both locations are on the path, AND in the order you want them to to be checked. So in your example, /usr/local/bin should be earlier in the PATH than /usr/local/bin/scripts. Most systems will probably have /usr/local/bin already in the system path, so ...

6

A slightly improved approach taken from Dennis' answer: function ls() { case $* in -la* ) shift 1; command ls -la "$@" | more ;; * ) command ls "$@" ;; esac } Or the one-liner: function ls() { case$* in -la* ) shift 1; command ls -la "$@" | more ;; * ) command ls "$@" ;; esac } This allows for further options/arguments to be appended after ...

6

Open AppleScript Editor. Paste in the following code: tell application "Finder" to shut down Click File » Save, save it to the Desktop, selecting File Format: Application. If you've saved it as the correct format, the icon should look like this:

6

Console2 is only a wrapper around hidden Win32 console windows and does not provide extended line editing functionality. You can create aliases in Win32 consoles: doskey d=dir $* Unlike Unix sh, you have to explicitly specify$* to append given arguments (ex. d C:\). You can also use $T to separate commands. Also unlike Unix, aliases are implemented at ... 6 From man bash: For almost every purpose, aliases are superseded by shell functions. So make it a shell function. function cmakerel { if expr match "$PWD" '.*bld.*' >/dev/null ; then cmake -D.... else echo "Wrong directory!" fi } It's a regular expression you can adjust to your needs.

6

No, you can't. As the bash manual states: There is no mechanism for using arguments in the replacement text, as in csh'. If arguments are needed, a shell function should be used (*note Shell Functions::). Functions are the right thing for this, and can be as easy to write as an alias. In this case, it could be function g () { grep --color=always ...

5

If you're going to use positional parameters in git aliases, be sure to specify sh -c. The following worked for me locally: ff = !sh -c 'git checkout master && git merge "$1" && git checkout "$1"' - The "why" relates to the way git parses the alias commands and is summed up in this gmane thread. The - at the end of the command signals sh ...

5

Although this question is over a year old and already answered, the following solution is simpler and avoids editing the registry: In Console2, go to Edit > Settings. Change the "Shell:" field to the following: C:\Windows\system32\cmd.exe /K "C:\Path\to\aliases.cmd" Now restart Console2 and you're done. To possibly save you some time, here's a simple ...

5

When you use alias ${alias_line}, the variable is broken up at spaces, ignoring quoting rules. There are two ways you could fix it: Remove all quoting from the alias file: ll=ls -lart psu=ps -fu$USER and put the variable itself in quotes: alias "$alias_line" This works because in bash, ll="ls -lart" and "ll=ls -lart" are exactly equivalent. ... 5 What you did should work. Troubleshooting: Are you under root? Did ln command actually succeed? Verify with ls -l /usr/bin/roo which should list the newly created link. If the link is not there, add "sudo " before ln to execute it as root (sudo will prompt for root's password): sudo ln -s /path/roo.sh /usr/bin/roo Sometimes bash remembers where a ... 5 You can create a function instead of an alias: function foo { cat somefile.txt rm anotherfile.txt } You can even pass parameters (foo somefile.txt) and use them as arguments to the commands (e.g. cat$1 for the first argument). This approach is more flexible than creating an alias.

5

Have you tried sshfs ? It's easy as > sshfs hostname: mountpoint and fusermount -u mountpoint and then you can use all the classic and basic file manipulation commands. http://en.wikipedia.org/wiki/SSHFS http://fuse.sourceforge.net/sshfs.html

5

I'd prefer to use a syntax like interactive FTP and just 'pull' files from the server to my local pwd. Use sftp. (Hint: If you cannot or do not want to open a new window, you can suspend the SSH connection by pressing Enter, ~, CtrlZ, transfer your files, and resume SSH with fg.) Another possible solution might be to have some way to automatically ...

5

Here is the source of the error message: $git log %ad fatal: ambiguous argument '%ad': unknown revision or path not in the working tree. Use '--' to separate paths from revisions You will get the same error message from the following two commands:$ git log --pretty=format:%h %ad | %s%d [%an] --graph --date=short $git log --pretty=format:\"%h %ad | ... 5 You can use command shell builtin command. It will execute only commands found in the PATH or shell builtins. It won't execute aliases or shell functions. Example: alias ls='ls -l'$ ls drwxr-xr-x 3 user user 4096 2010-10-11 13:17 dir1 drwxr-xr-x 3 user user 4096 2010-10-15 15:37 dir2 $function ls() { > echo hello > }$ ls hello \$ command ls dir1 ...

5

Because of spam, most (if not all) ISP and email providers will not allow you to spoof an email using their SMTP servers. You will need to sign up for a hosted email package which will provide you with an SMTP server for use with your domain. The registrar of your domain may offer such a package. If not there are many hosting providers which offer email ...

5

A slightly less convienent way is to set up aliases for both ping and ssh, for example: alias pingfoo="ping foohost.domain.tld" OpenSSH supports adding hostname aliases (and many more options) to ~/.ssh/config: Host foo Hostname foohost.domain.tld # You can also add User, Port, every possible ssh(1) option.

5

Also sort of off-topic - Use PowerShell instead of the cmd.exe command line. The good news is that PowerShell has the equivalent of .bash_profile, and runs just like the cmd.exe command line. It comes with a built-in alias generation feature. The bad news is that there is a bit of a learning curve if you want to do anything more complicated than simple ...

5

http://www.sunmanagers.org/archives/1996/0273.html 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 ...

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