Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

0 votes
1 answers
51 views
Unavailable executable still remains
Please note: This is not a question related to pip or python. I am trying to make sense of why I see a "permission error" instead of "path not found" error. I have done many installations and uninstallation for different softwares including python. So I can't recall how the setup was many years back...
Please note: This is not a question related to pip or python. I am trying to make sense of why I see a "permission error" instead of "path not found" error. I have done many installations and uninstallation for different softwares including python. So I can't recall how the setup was many years back. My core question is why I see an "zsh: permission denied: pip" instead of "pip not found". When an executable doesn't exist, I would expect it to be say "not found" vs pointing to a possible permission issue. And secondly; is there a way in linux\unix\mac to identify all commands\symlinks\aliases that are broken now? Here is my terminal output ayusman :$ pip zsh: permission denied: pip ayusman :$ which pip pip not found ayusman :$ type pip pip not found ayusman :$ Thank you.
Ayusman (141 rep)
Aug 5, 2025, 12:26 AM • Last activity: Aug 6, 2025, 11:20 PM
2 votes
1 answers
2339 views
Is it possible to give alias name to ip address with port number in CentOS 7
I have one question regarding given alias to ip address with port number. For example I am executing jenkins in my local system in port number 8080 and nexus in port number 8081. I will accessing GUI by typing address manually as below. For jenkins: `192.168.122.1:8080` For Nexus: `192.168.122.1:808...
I have one question regarding given alias to ip address with port number. For example I am executing jenkins in my local system in port number 8080 and nexus in port number 8081. I will accessing GUI by typing address manually as below. For jenkins: 192.168.122.1:8080 For Nexus: 192.168.122.1:8081 Instead of following above process it is possible to alias names as below. 192.168.122.1:8080 -> jenkins.world 192.168.122.1:8081 -> nexus.world or alias as below. 192.168.122.1:8080 -> go/jenkins 192.168.122.1:8081 -> go/nexus Can you please check and advice about the feasibility of above type of alias in CentOS 7.6 OS.
Bitra Hemanth (21 rep)
Jun 20, 2019, 05:35 AM • Last activity: Aug 5, 2025, 09:10 AM
0 votes
1 answers
2926 views
Use aliases as custom commands in terminator
I am using a terminator layout to start multiple terminals, and would like to call an alias at each terminal start which is defined in my `.bash_aliases` (called by both `.bashrc` and `.profile`). Terminator unfortunately doesn't know about those aliases when starting the terminals. How can I fix th...
I am using a terminator layout to start multiple terminals, and would like to call an alias at each terminal start which is defined in my .bash_aliases (called by both .bashrc and .profile). Terminator unfortunately doesn't know about those aliases when starting the terminals. How can I fix that? I start terminator with this command: terminator -l my_layout -f EDIT: As a temporary solution, I ssh -A -YC into myself and then run the alias. All this as a custom command.
Mehdi (422 rep)
Nov 18, 2015, 01:48 PM • Last activity: Jul 31, 2025, 05:05 PM
-1 votes
2 answers
121 views
Unable to Execute Multiple Alias Commands Simultaneously
I'm encountering an issue where I'm unable to execute multiple alias commands at the same time in my shell environment. For example, when I try to run two alias commands together, only one seems to execute, or I get an error. I've tried defining the aliases separately and then combining them in a si...
I'm encountering an issue where I'm unable to execute multiple alias commands at the same time in my shell environment. For example, when I try to run two alias commands together, only one seems to execute, or I get an error. I've tried defining the aliases separately and then combining them in a single command using && and ;, but it still doesn't work as expected. Here's a simplified version of what I'm trying: alias1 alias2
Subhash (1 rep)
Jul 28, 2025, 01:39 PM • Last activity: Jul 30, 2025, 09:17 AM
-4 votes
0 answers
33 views
Unable to Execute Multiple Alias Commands
I'm encountering an issue where I'm unable to execute multiple alias commands at the same time in my shell environment. For example, when I try to run two alias commands together, only one seems to execute, or I get an error. The below example shows that what I am exactly trying If I want to copy fi...
I'm encountering an issue where I'm unable to execute multiple alias commands at the same time in my shell environment. For example, when I try to run two alias commands together, only one seems to execute, or I get an error. The below example shows that what I am exactly trying If I want to copy file.txt from one system another system, we scp command. So, i was trying scp -i auth_key file.txt userid@target_hostname:/target/path/ alias1= 'scp -i auth_key' alias2= 'userid@target_hostname:/target/path/' I was trying to execute the below command alias1 file.txt $alias2
Subhash (1 rep)
Jul 29, 2025, 02:45 PM • Last activity: Jul 29, 2025, 02:49 PM
-1 votes
1 answers
77 views
Why doesn't bash recognize alias in interactive mode?
How is this possible? ```none styx@LouSTyx:…$ GCOM​ "\pushdict now ignores prefix macro." GCOM​ : commande introuvable styx@LouSTyx:…$ type GCOM GCOM est un alias vers « git commit -a -m  » ```
How is this possible?
styx@LouSTyx:…$ GCOM​ "\pushdict now ignores prefix macro."
GCOM​ : commande introuvable
styx@LouSTyx:…$ type GCOM
GCOM est un alias vers « git commit -a -m  »
STyx (1 rep)
Jul 19, 2025, 01:01 PM • Last activity: Jul 26, 2025, 03:47 PM
141 votes
10 answers
63575 views
How do I get bash completion for command aliases?
I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias : alias apt-inst='sudo aptitude install' Is there a way to get the completions provided by aptitude when I hit the tab key? i.e. when I write 'sudo aptitude install gnumer' and hit tab, apti...
I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias : alias apt-inst='sudo aptitude install' Is there a way to get the completions provided by aptitude when I hit the tab key? i.e. when I write 'sudo aptitude install gnumer' and hit tab, aptitude completes this to gnumeric, or if there was uncertainty lists all the available packages starting with gnumer. If I do it using my alias, nothing - no completion.
levesque (3915 rep)
Nov 20, 2010, 04:13 PM • Last activity: Jul 21, 2025, 09:57 PM
0 votes
1 answers
43 views
Alias for rm does not include file name with @$
I am trying to create an alias for the rm command in the /root/.bashrc file on a VirtualBox Redhat VM (running RHEL 9). I cannot get it to work properly. This is an excerpt of my .bashrc file: ``` alias rm='printf "rm: cannot remove %s: Permission denied\n" "$@" && w >> /tmp/logfile_20090204_001.log...
I am trying to create an alias for the rm command in the /root/.bashrc file on a VirtualBox Redhat VM (running RHEL 9). I cannot get it to work properly. This is an excerpt of my .bashrc file:
alias rm='printf "rm: cannot remove %s: Permission denied\n" "$@" &&  w >> /tmp/logfile_20090204_001.log'
sudo() {
	if [[ "$1" == "rm" ]]; then
		for file in "${@:2}"; do
			printf "rm: cannot remove %s: Permission denied\n" "$file"
		done
		w >> /tmp/logfile_20190204_002.log
	else
		command sudo "$@"
	fi
}
I reload it with . /root/.bashrc. The result I get when using rm is
: cannot remove : Permission denied
(no file name). I have tried replacing printf with echo, switching the single and double quotes and modifying the bash_aliases file instead of the .bashrc file, and nothing seems to work. How can I get this alias to print my file name (with and without sudo)? Thank you in advance for your help!
minionsaregreat (3 rep)
Jul 10, 2025, 12:42 PM • Last activity: Jul 10, 2025, 01:02 PM
1 votes
1 answers
1450 views
Creating an alias for the find command in Linux
I have created the following alias in my `.bashrc` file: alias find='find . -type f -name' This obviates the need to type `. -type f -name` every time I do a file search. However, I still have to enclose search strings with '\*...*'. How could I include these in the alias, so that instead of having...
I have created the following alias in my .bashrc file: alias find='find . -type f -name' This obviates the need to type . -type f -name every time I do a file search. However, I still have to enclose search strings with '\*...*'. How could I include these in the alias, so that instead of having to type: find '*string*' I could just type, find string
edman (588 rep)
Jul 27, 2021, 04:57 PM • Last activity: Jun 29, 2025, 06:27 AM
1 votes
1 answers
54 views
How to define a recursive alias in csh (intentionally!)
It is known that attempting to invoke a custom alias inside itself (be it directly; or indirectly via intermediate aliases that call each other) would cause an "**`Alias loop.`**" error, and rightfully so. However, I would like to write a recursive `csh` alias, as I intend to include a base case to...
It is known that attempting to invoke a custom alias inside itself (be it directly; or indirectly via intermediate aliases that call each other) would cause an "**Alias loop.**" error, and rightfully so. However, I would like to write a recursive csh alias, as I intend to include a base case to the recursion, so in my use case it is not an infinite loop. Here's a simplified example:
alias countdown 'if ( \!* > 0 ) then; echo \!*; countdown expr \!* - 1; endif;'
The expected output from this alias, for example with input 3, should be:
$ countdown 3
3
2
1
0
Attempting to define such an alias leads to the aforementioned "**Alias loop.**" error on csh. How can I achieve this functionality correctly? I tried using a while loop in the alias instead of recursion, but [it doesn't seem to be supported in csh](https://stackoverflow.com/a/61298726/10679420) , and [other workarounds for this alias loop issue](https://unix.stackexchange.com/q/28704/459071) are not applicable since I do not have a built-in counterpart to invoke.
Vadrif Draco (111 rep)
May 11, 2025, 01:05 PM • Last activity: Jun 2, 2025, 06:50 AM
0 votes
0 answers
67 views
Command 'cdh' not found appearing at the top of CL when opened
I am new to Ubuntu, and I am using the latest version. Initially, I wanted to create an alias, using: alias cdh='cd /home/[My name]/' This was done since I wanted to download video files to a different hard drive than my M.2., and convert them to a different format. However, I ran into the error of...
I am new to Ubuntu, and I am using the latest version. Initially, I wanted to create an alias, using: alias cdh='cd /home/[My name]/' This was done since I wanted to download video files to a different hard drive than my M.2., and convert them to a different format. However, I ran into the error of the cd not working. I reset the paths with unaliasing cdh, and then changing the directory using ~$ cd / so that it would point to the root. However, now every time I open the Command Line, I get: Command 'cdh' not found, did you mean: command 'cdb' from deb tinycdb (0.78build3) command 'cdp' from deb irpas (0.10-9) command 'cdw' from deb cdw (0.8.1-2) command 'cdo' from deb cdo (2.0.4-1) command 'dch' from deb devscripts (2.22.1ubuntu1) command 'cde' from deb cde (0.1+git9-g551e54d-1.2) command 'dh' from deb debhelper (13.6ubuntu1) command 'csh' from deb csh (20110502-7) command 'csh' from deb tcsh (6.21.00-1.1) command 'cph' from deb conda-package-handling (1.7.3-2build1) command 'cdi' from deb cdo (2.0.4-1) command 'cd5' from deb cd5 (0.1-4) Try: sudo apt install bash: cd: too many arguments This does not seem to affect anything though, as I went through and checked stuff like brew and the CLI I installed to convert things, but I am concerned that it is sending those messages when just opening the command line. If there is further detail I need to add to this question, I am willing to do so. Please go easy on me, again I am completely new to this stuff and I just wanted to set up some video converting CLI in Ubuntu 22.04.4 LTS. **EDIT 1:** It is defined in the ~/.bashrc, as even on start up after a fresh reset the error still appears at the top.
CurrentBitMiner (1 rep)
May 14, 2024, 10:42 PM • Last activity: Jun 1, 2025, 09:07 AM
1 votes
1 answers
83 views
Bash profile seems not to be loaded when -c option is present
There are a fair bit of similar questions, but I can't find spec for this particular case. I'm writing a shell script to verify bash configuration. For exmaple, I add `test_alias` to `~/.bashrc`, which is also sourced from `~/.bash_profile` so the configuration can be loaded both for interactive and...
There are a fair bit of similar questions, but I can't find spec for this particular case. I'm writing a shell script to verify bash configuration. For exmaple, I add test_alias to ~/.bashrc, which is also sourced from ~/.bash_profile so the configuration can be loaded both for interactive and login shell. And I am aiming to test this within shell script for the users who previously had ~/.bashrc but had not sourced that in profile before. So I want to programatically test against profile configuration at ~/.bash_profile, not ~/.bashrc. Here's an exmaple setup. ~/.bashrc
alias alias_test='echo "Test succeeded."'
~/.bash_profile
source ~/.bashrc
Then I go to shell and test them.
# Try testing in one line command for login shell
# I excect this to load profile before running command 
# provided in option.
# However it doesn't seem to have loaded it.
% bash -lc "test_alias"
> bash: line 1: alias_test: command not found

# Just to verify that the configuration itself is successful,
# if I try to do that interactively, it actually works.
% bash -l
[bash login shell] % test_alias
[bash login shell] > Test succeeded.

# This works too, but this isn't what I want to test 
# as I understand that this directly loads ~/.bashrc 
# even without configuring profile.
% bash -ic "test_alias"
> Test succeeded.
This confuses me, because man bash does not seem to address this behavior. > When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior. This looks to me as though -l (or --login) changes shell initialization behavior depending on the other factors such as if -c is set or not. However for some reasons I can't find the documentation or source that sites this. What am I missing here? --- By the way, the environment I'm testing on is macOS and bash is the one installed by homebrew. (GNU bash, version 5.2.37(1)-release (aarch64-apple-darwin24.2.0)
Iorippi (13 rep)
May 26, 2025, 05:34 AM • Last activity: May 27, 2025, 11:16 AM
0 votes
2 answers
92 views
In a bash alias, how do I run "apt autoremove" automatically after "apt upgrade" only if needed?
I have two alias in my Debian's .bashrc: alias upd='sudo apt update && apt list --upgradable' alias upg='sudo apt upgrade' Then I use `upd` to update and display all upgradable packages, and `upg` to do the upgrade. Sometimes the output of upgrade says something like "use 'apt autoremove' to remove...
I have two alias in my Debian's .bashrc: alias upd='sudo apt update && apt list --upgradable' alias upg='sudo apt upgrade' Then I use upd to update and display all upgradable packages, and upg to do the upgrade. Sometimes the output of upgrade says something like "use 'apt autoremove' to remove them". I would like to append && sudo apt autoremove to the second comand, if mentioned in the upgrade's output. Is this possible inside the alias? Or maybe I should just append it, and it won't do anything if not requested? (Still, it would be nice to learn the complete thing.) Or maybe I'll need to create a script that will be called in the alias? Also, I'd like to see the whole output too, and not just send it to another command input via pipe.
Rodrigo (1894 rep)
May 25, 2025, 01:40 AM • Last activity: May 25, 2025, 03:26 PM
0 votes
1 answers
2748 views
grep alias to safely ignore multiple directories
The day to day usage is: grep -rIn pattern directory There are some files that I want to avoid, they are in directories that have this kind of path in them at some point: `app/lib/bower/lodash`, `app/lib/bower/paho-mqtt-js`, `app/lib/bower/socket-io-client`. Ideal solution is to detect `app/lib/bowe...
The day to day usage is: grep -rIn pattern directory There are some files that I want to avoid, they are in directories that have this kind of path in them at some point: app/lib/bower/lodash, app/lib/bower/paho-mqtt-js, app/lib/bower/socket-io-client. Ideal solution is to detect app/lib/bower/ in the path, but it's hard. Is it possible? I've come up with: alias grep='grep --exclude-dir={lodash,paho-mqtt-js,socket-io-client}' Good enough (though needs maintenance when new stuff is added). How to at least add a short warning into stderr if the directory is excluded by grep?
Velkan (581 rep)
Sep 29, 2016, 08:03 AM • Last activity: May 14, 2025, 07:05 PM
326 votes
25 answers
281181 views
How to have tail -f show colored output
I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's `SEVERE`, show the line in red; if it's `INFO`, in green. What kind of alias can I setup for a `tail` command that would help me do this?
I'd like to be able to tail the output of a server log file that has messages like: INFO SEVERE etc, and if it's SEVERE, show the line in red; if it's INFO, in green. What kind of alias can I setup for a tail command that would help me do this?
Amir Afghani (7373 rep)
Mar 1, 2011, 07:13 PM • Last activity: May 9, 2025, 02:50 PM
8 votes
2 answers
7304 views
cp -f cannot overwrite cp -i alias
In my /home/user/.bashrc file, I have those aliases to prevent mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' If I'm really sure of what I'm doing, I can overwrite `rm` and `mv` aliases using `rm -f` or `mv -f`, it will not ask me if I really want to overwrite files. The problem, is th...
In my /home/user/.bashrc file, I have those aliases to prevent mistakes: alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' If I'm really sure of what I'm doing, I can overwrite rm and mv aliases using rm -f or mv -f, it will not ask me if I really want to overwrite files. The problem, is that it doesn't work for the cp command, using cp -f will still ask me a question. Is this normal? What should I do in order to have cp -i alias by default and be able to use cp -f command too? I'm using Debian Wheezy 64bit.
baptx (287 rep)
Dec 3, 2012, 12:18 PM • Last activity: Apr 28, 2025, 04:12 PM
0 votes
2 answers
88 views
How to expand a Bash alias given as an argument?
I probably approach this problem wrong. I update my Linux machines with bash aliases like: ```bash alias upg-pi='\ssh -c aes128-gcm@openssh.com -C -i $ssh_identity -o ConnectTimeout=$ssh_timeout root@$ssh_ip_rpi4 -t /root/upgrade' ``` That alias above, I wrote explicitly, it actually consists of `ss...
I probably approach this problem wrong. I update my Linux machines with bash aliases like:
alias upg-pi='\ssh -c aes128-gcm@openssh.com -C -i $ssh_identity -o ConnectTimeout=$ssh_timeout root@$ssh_ip_rpi4 -t /root/upgrade'
That alias above, I wrote explicitly, it actually consists of ssh-pi alias:
alias upg-pi='ssh-pi -t /root/upgrade'
I tried expand_aliases and alike. *** Goal - Be able to run several gnome-terminal windows at the same time like:
function upg_all()
{
    gnome-terminal --window -- upg
    gnome-terminal --window -- upg-pi
    # ...
}
I need to sleep now, see you in the morning. Hopefully with some solution. It's Bash-specific on Mint 22. I have full control of this OS. Thanks.
Vlastimil Burián (30505 rep)
Apr 10, 2025, 07:30 PM • Last activity: Apr 11, 2025, 12:37 PM
20 votes
2 answers
41841 views
Run a command in an interactive shell with ssh after sourcing .bashrc
I want to ssh into a remote Ubuntu computer, source my `.bashrc` and run a command that depends on parameters set by that `.bashrc`. All that in an interactive shell that doesn't close after the command is done. What I tried until now is ssh user@remote_computer -t 'bash -l -c "my_alias;bash"' or ju...
I want to ssh into a remote Ubuntu computer, source my .bashrc and run a command that depends on parameters set by that .bashrc. All that in an interactive shell that doesn't close after the command is done. What I tried until now is ssh user@remote_computer -t 'bash -l -c "my_alias;bash"' or just ssh user@remote_computer -t "my_alias;bash" This works for general commands (like ls for example) but when I try to run an alias defined in .bashrc I get an error: bash: my_alias: command not found But then when I write it manually again and run it, it works! So how can I make sure the the .bashrc is sourced before the command is called?
Mehdi (422 rep)
Nov 18, 2015, 11:09 AM • Last activity: Apr 8, 2025, 03:00 PM
1 votes
1 answers
1021 views
Bash alias not working for aliased command in Linux
Trying alias in Bash, not able to see it working in conjunction with ```cd``` command or maybe any command. ``` [0s][/nobackup/sumikum7]> sjc-tftp -bash: /auto/tftp-xeinfra/sumikum7/: Is a directory [0s][/nobackup/sumikum7]> cd sjc-tftp -bash: cd: sjc-tftp: No such file or directory [0s][/nobackup/s...
Trying alias in Bash, not able to see it working in conjunction with
command or maybe any command.
[0s][/nobackup/sumikum7]> sjc-tftp
-bash: /auto/tftp-xeinfra/sumikum7/: Is a directory
[0s][/nobackup/sumikum7]> cd sjc-tftp
-bash: cd: sjc-tftp: No such file or directory
[0s][/nobackup/sumikum7]> cd /auto/tftp-xeinfra/sumikum7/
[0s][/auto/tftp-xeinfra/sumikum7]>
Tried searching few places, but didn't find this issue mentioned anywhere for Linux. Note: - bash version : GNU bash, version 4.4.19(1)-release (x86_64-redhat-linux-gnu) - Found something for MAC, lemme kindly know if this is the reason here as well.
Sumit Singh (113 rep)
Jun 30, 2021, 05:39 AM • Last activity: Apr 1, 2025, 10:00 AM
0 votes
1 answers
2678 views
How to execute an alias, encapsulated in another source file?
For instance `~/.cshrc`: `alias job_start 'cd $PROJ_DIR && source .env/bin/activate.csh && rehash && job_run'` `$PROJ_DIR/.env/bin/activate.csh`: alias job_run '(cd $PROJ_DIR/builds; sh run.sh)' after calling job_start: % job_start [4/36] job_run: Command not found. But aliases updates after calling...
For instance ~/.cshrc: alias job_start 'cd $PROJ_DIR && source .env/bin/activate.csh && rehash && job_run' $PROJ_DIR/.env/bin/activate.csh: alias job_run '(cd $PROJ_DIR/builds; sh run.sh)' after calling job_start: % job_start [4/36] job_run: Command not found. But aliases updates after calling job_start -> job_run appears. Manually calling job_run will proceed as expected.
kAldown (277 rep)
Jan 25, 2017, 10:45 AM • Last activity: Mar 27, 2025, 10:03 PM
Showing page 1 of 20 total questions