Linux CentOS 7 - Configuring aliases
Configure a simple alias for a complex command. For instance,
create a custom
command called qstat on system1 that runs the command:
/bin/ps
-Ao pid,tt,user,fname,rsz
This command
should be available to all users on the system.
On system1:
Edit the /etc/bashrc file:
# vim /etc/bashrc
Scroll to the bottom of the file and add this line:
alias qstat="bin/ps
-Ao pid,tt,user,fname,rsz"
then save and exit; run the command:
# source /etc/bashrc
Verfiy by running the command:
# qstat
Sample output:
PID TT USER COMMAND RSZ
1 ? root systemd 6864
2 ? root kthreadd 0
3 ? root ksoftirq 0
5 ? root kworker/ 0
7 ? root migratio 0
8 ? root rcu_bh 0
9 ? root rcu_sche 0
10 ? root lru-add- 0
11 ? root watchdog 0
13 ? root kdevtmpf 0
Sample output:
PID TT USER COMMAND RSZ
1 ? root systemd 6864
2 ? root kthreadd 0
3 ? root ksoftirq 0
5 ? root kworker/ 0
7 ? root migratio 0
8 ? root rcu_bh 0
9 ? root rcu_sche 0
10 ? root lru-add- 0
11 ? root watchdog 0
13 ? root kdevtmpf 0
Commenti
Posta un commento