Is there a possibility to add some text at the end of every command i type in the terminal? For example i type "ps" and after pressing enter, it becomes "ps -a", I type "ls" and it's "ls -a"
Asked
Active
Viewed 272 times
2 Answers
1
It sounds like you want to create an alias in your .bashrc (hidden and located in user home directory)
Just add the following lines to your .bashrc:
alias ls='ls -a'
alias ps='ps -a'
and then run the command to source your .bashrc
source ~/.bashrc
Doing this will now cause every ls to also show hidden files (files starting with a .) and every ps you run to show all processes except both session leaders and processes not associate with a terminal.

Jay Hawk
- 43
0
Easy to do with a shellscript:
#!/bin/bash
while :
do
echo "\$ \c"
read command
[ $command == "quit" ] && break
eval $command -a
done

RalfFriedl
- 8,981

unxnut
- 6,008
rm
becomesrm -a
, and you get an error message for an invalid option? (same formv
) Are you sure you want to add that to each and every command line? – ilkkachu Aug 29 '18 at 20:51-a
option – MSSC Sep 02 '18 at 17:17