Posts

Showing posts with the label bash

bash tips

- no title specified Little-known bash commands for the SysAdmin Toolbox finger  This is a user-information lookup program, which display information on system users.  If it's executed without an argument it will display a list of currently-logged in users: Login     Name       Tty      Idle  Login Time   Office     Office Phone   Host user1     user1     tty1     1:40  Jan  7 15:57                           (:0) user1     user1     pts/0          Jan  7 15:58                           (192.168.9.1) Given a username as an argument it will display extended information on that user: # finger user1 Login: user1                         Name: user1 Directory: /home/user1               Shell: /bin/bash On since Thu Jan  7 15:57 (CST) on tty1 from :0     1 hour 40 minutes idle On since Thu Jan  7 15:58 (CST) on pts/0 from 192.168.9.1    4 seconds idle No mail. No Plan. chfn Similarly, use the chfn command to change the information that the finger command displays. SYNOPSIS        chfn [-f fu…

Linux date Command: Day of Week

To find the day of week (e.g. Friday) on a particular date using the Linux version of the `date` utility, execute:

$ date -d 'Jan 03 2004' "+%a" Sat

The -dflag tells the utility to display the information only, instead of setting the date, etc.

The "+%a" options are`date`'s FORMAT options, which are listed in the manpages.
So, for example, we can also have the full name of the weekday output by changing the "+%a" to "+%A". $ date -d 'Jan 03 2004' "+%A" Saturday
DATE(1) User Commands NAME date - print or set the system date and time SYNOPSIS date [OPTION]... [+FORMAT] ... ... FORMAT controls the output. Interpreted sequences are: %% a literal % %a locale's abbreviated weekday name (e.g., Sun) %A locale's full weekday name (e.g., Sunday) %b locale's abbreviated month name (e.g., Jan) %B locale's…

Linux: Keyboard-Mapping Control

Remapping Keys Given the variations in physical keyboard layouts across personal computers from different manufacturers, the potential for a configured key to be mapped differently than expected or even to be missing on some keyboards creates the need for System Administrators to be able to remedy this problem by remapping the desired functions to the available key(s) of their choosing.  Luckily, there are a number of powerful tools available for the Linux OS, some of which will be outlined in this note with a few usage examples and scenarios.

xevxmodmapshowkeyloadkeys
How to Map the Super key to Search key The Samsung Chromebook doesn't have a Super key, or "Windows" key, on its keyboard; as a result, the Super key, which is usually mapped to it by default, is missing from the keyboard and the user is missing a useful function from certain applications.
    In order to provide the user with a convenient shortcut on their keyboard, first we need to find find out some mo…

RHEL-RHCSA-clock_Timezone.md

localtimeUpon a successful login into the VM system, changing the Timezone to which the system’s time is configured can be accomplished by changing the /etc/localtimelink. NOTE
Since the implementation of systemd in RHEL7, changing the system’s default
timezone manually is not persistent; as the /etc/localtime link gets recreated
by systemd after a reboot, the user must use timedatectl to make the desired
change persistentTo change the default timezone to the timezone of Chicago, for example, execute the following as the root user:# cd /etc/ # ls -alh localtime /etc/localtime -> ../usr/share/zoneinfo/America/NewYork # unlink /etc/localtime # ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime /etc/localtime -> ../usr/share/zoneinfo/America/Chicago In the above example, we have changed the timezone from the previous value, pointing to the timezone to which “NewYork” belongs, to the timezone of Chicago.The systemd Method for Changing the Default TimezoneSynops…

Recover Fedora21 after Removing swap LVM Partition

Image
"God" help you if you make the mistake, as I did today on a newly-installed Fedora21 system, to delete an LVM swap partition without taking the proper precautions before rebooting. If you are in this position, or have been in the past, you've come face to face with the dracut rescue shell and its limited set of "shell" commands. While the rescue shell offers some potentially useful functions (commands), I could not successfully use it to implement any of the advised steps from manual pages and internet forums I came across when searching for a solution to this problem.
The Fedora Wiki page on "How to debug Dracut problems" suggested activating the root and any other logical volumes by executing  # lvm vgscan # lvm vgchange -ay "With the root volume available, you may continue booting the system by exiting the dracut shell" exit Though, in fairness, that resolution was dealing with unlocking an encrypted root volume with an additional …