简体   繁体   中英

How to set alias to a text file or python file and call it by their alias?

I'm trying to figure out how to set an alias to a certain file then call them. How to make it work? I've tried to search it, but none of them seems to work the way that I want it to.

So when I ps aux | grep python ps aux | grep python I get the following output:

root      4226  0.0  0.3  30452  8204 pts/0    T    Jun24   0:00 python

It displays like this, but when my supervisor uses that command it displays the alias after the command. Why is that happening when I am issuing the command?

To set an alias you edit either your own bash settings (~/.bashrc) or the global setting /etc/bash.bashrc

To set an alias you can simply enter a line like this one:

alias grep='grep --color'

This works by replacing anything you enter in your bash with the alias assignment. So if i were to enter:

cat someFile | grep -n nope

bash would execute the command as if i had typed:

cat someFile | grep --color -n nope' 

So if you want to get the same output as your co-worker you'll just have to ask for the alias line or the bashrc as a whole and extract the aliases you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM