Passa ai contenuti principali

Linux CentOS 7 - Configuring aliases

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
 




Commenti

Post popolari in questo blog

Using Wallys Communications DR4018H access point Introduction WiFi Analyzer is an open-source app for Android, available for download from Google Play. It allows the user to optimize their WiFi network by examining surrounding WiFi networks, measuring their signal strength as well as identifying crowded channels. This application does not require access to internet, therefore it does not send any personal/device information to any other source and it does not receive any information from other sources. I installed it on my Samsung Galaxy smartphone and I tested the connection to the Wallys Communications DR4018H access point (see picture below) . The findings are described below. Procedure I linked the AP to my home router in the entrance hall of my apartment. The SSID is called “WIFIA” and the smartphone is connected. It receives a local IP address from the router directly connected to the AP.     The received power at abo...

Linux CentOS 7 - Mounting the iso file as a CD-ROM

Linux CentOS 7 - Mounting the iso file as a CD-ROM in a repo Mount the iso file as a CD-ROM in a repository. Provided your iso file contains the complete operative system, this allows you to disable the default repositories and mirrors and install all required packages without downloading them from the internet. In other words you can work off-line. On system1 and/or system2 Edit the repo file vim /etc/yum.repos.d/CentOS-CD.repo [CentOS-CD] name =  CD ROM baseurl = file:///media/CentOS gpgcheck = 0 enabled = 1 Mount the iso file as a CD-ROM in a repository. Make a mount point mkdir /media/CentOS Edit the fstab file /dev/cdrom     /media/CentOS   iso9660   loop 0 0 mont -a Verify df -Th it must return the /dev/loop0 disk yum repolist it must show the repositories contained in the iso file.

Linux CentOS 7 - Configuring a cache-only DNS

Linux CentOS 7 - Configuring a cache-only DNS Configure a cache only DNS server which forwards requests to the well known Google DNS server. On system1 Install the unbound package # yum install -y unbound Enable and start the service # systemctl enable unbound && systemctl start unbound Adjust the configuration file # vim /etc/unbound/unbound.conf interface: 0.0.0.0                       ## all interfaces access-control: 0.0.0.0/0 allow ## from all networks forward-zone      name: "."                              ## from any domain      forward-addr: 8.8.8.8           ## DNS server towards which all requests will be forwarded Check configuration  # unbound-checkconf Modify the DNS server on the interface configuration # vim /etc/sysconfig/network-scripts/ifc...