All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
2answers
49 views

Any way to recall the file of previous cmd? [duplicate]

Frequently I’ll have to do some digging around to figure out what I’m doing on linux, involving quite a bit of ‘’, ‘ls -la’, ‘cd’, ‘cat’, and ‘vim’ Is there any way to quickly reuse the file/target ...
0
votes
3answers
101 views

How to replace a sequence of commands by a single command in linux?

How can we replace the following commands netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n by our special command like this: ab1 my mean is I want to use my command ab1 instead of ...
1
vote
2answers
2k views

How to alias a command containing both apostrophes and quotation marks?

As a result of my previous question I decided to alias groe= ?vim -c 'normal "+p1Gdddd"' -c ':%s/\n/' -c 'normal"gVGgJy"' -c'q!'? I cant find out how to substitute '?s' in my example to make it ...
1
vote
1answer
71 views

Aliasing a command with special parameters [duplicate]

I would like to have an alias for the following code:- g++ *.cc -o * `pkg-config gtkmm-3.0 --cflags --libs`; but I want that when I enter the alias it should be followed by the file name *.cc and ...
6
votes
3answers
557 views

Identify alias for the command typed

Is there any shell/shellscript which identifies that there is already an alias for the command I have typed on the command line. Eg On shell I type git checkout master Shell prints "You can use ...
0
votes
1answer
791 views

How can I add default command line parameters to an executable in a way that will also work on GUI apps? [duplicate]

I want to pass a command line program by default when I run it. myprog --foo=bar The solution I could think of was to add a custom "myprog" wrapper to my "bin" folder #! /bin/sh /usr/bin/myprog --...
9
votes
2answers
813 views

Run another command before running the command the user wants to run

Let's say I want to modify the original behavior of the ls tool this way: $ ls Hello World file1 file2 ... How can I do this? When running ls I would like to run another command let's say echo "...
6
votes
4answers
16k views

Command line shortcuts for changing directory [duplicate]

I'm looking for an easy way to navigate to directories spanning multiple hard drives and want to set something equivalent to a shortcut within the terminal. In Windows I would accomplish this with ...
3
votes
2answers
1k views

Can I run a command after the user uses Ctrl-C to kill a command?

So at my position we use a shared set of aliases to do builds. Something like... alias 'build'='cd $BUILD_ROOT; m; cp ...; cp...; deploy; deploy; deploy; cd -' This is super irritating because the ...
19
votes
6answers
4k views

Why is aliasing over standard commands not recommended?

For example, a common alias I've seen in the ~/.bashrc file (or equivalents) is alias rm='rm -i' However, I've seen people recommend against this because the alias might not exist on another system ...
119
votes
36answers
56k views

Quick directory navigation in the bash shell

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/. But I don't want to type cd /[full-path]/...
5
votes
4answers
166 views

Change command-line “environment” to programs command

In a console, is it possible to change into a commands "environment"? To explain, I take "git" as an example. While programming and using a git repository, I change to the repos path and then do many "...