Saturday, February 20, 2021

Updating the bash $PATH variable

 When writing scripts, you usually want to store them in a folder that is defined in the bash $PATH variable. For example, you might want to create a 'bin' directory in your /home/user/ directory. Typing the following command will check to see if the directory already exists and if not it will go ahead and create it:




Here's a great article explaining how to make this PATH variable permanent:


Updating the PATH variable:


Wednesday, February 3, 2021

Login Monitoring

Here are a few helpful commands that will allow you to keep track of user login status of your Linux system. The first two commands are pretty straight forward: whoami and logname 


 



These two commands show that I'm currently working as sziegenbusch. At first glance there doesn't seem to be much difference between these two commands, however, when I switch user to kingtux I can see the difference.

 


 

 

 

 

I run whoami and learn that I'm current using the kingtux account, however, when I run the logname command I see that I'm sziegenbusch.

Another helpful command you can use to display who is logged in and related data (e.g., processes, boot time) is who




You can use the who command with the -a and -H options to see all available information and column headers:





The w command also displays who is logged on and the processes. You can read more information about the w command at The w command. 




The id command will show you a lot of information regarding your current user or an arbitrary user:




Other helpful commands for monitoring log in information are: lastlog, last -F, and lastb.

Welcome Back to Linux Quick Notes!

Hello and welcome to the relaunched Linux Quick Notes! I’m Steven, and I’m thrilled to revive this blog, originally created four years ago d...