CentOS 7

Show Display Date And Time For Command History

Share on LinkedIn

How would you display shell command history with date and time under Linux or UNIX operating systems? For instance, CentOS?

If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file, marked with the history comment character. Defining the environment variable as follows:

HISTTIMEFORMAT="%d/%m/%y %T "

OR

echo 'export HISTTIMEFORMAT="%d/%m/%y %T "' >> ~/.bash_profile

To see history type

history

Sample Output:

1002 29/01/15 11:11:07 hwclock --systohc
1003 29/01/15 11:11:10 date
1004 29/01/15 11:11:22 hwclock -show
1005 29/01/15 11:11:25 hwclock -r
1006 29/01/15 11:11:32 history
1007 29/01/15 11:21:15 ip addr
1008 29/01/15 11:21:19 show ip addr
1009 29/01/15 11:21:28 history | grep ip
1010 29/01/15 11:22:34 ip addr sh
1011 29/01/15 11:22:42 hostname
1012 29/01/15 11:22:49 ifconfig
1013 29/01/15 11:24:01 history

Note: Date and Time will only appear for new commands. All previous commands will be stamped with the time and date you issued the ‘HISTTIMEFORMAT’ command.

How To Find MAC Address On Your Windows Computer

What is a MAC address? MAC address stands for “media access control” address. It’s a unique identifier assigned to network interfaces. Unlike an IP address that can easily be changed, a MAC address is normally assigned by the network interface manufacturer and is used for communications on the physical network segment. It’s also known as the Physical Address.

On a Microsoft Windows machine, pull up the command prompt. On a Windows 7 machine, click on the Windows start icon, go to All Programs, then to Accessories. There you will find Command Prompt.

Once the command prompt opens, type in the following and press Enter.

ipcofig /all

You will receive something similar to this:

ipconfig-all

 

 

Your MAC or Physical Address looks like this:

mac-address

 

On other devices such as mobile phones, iPads, and Kindles, the IP Address may appear in a similar format such as this:

D0:67:E5:04:3D:06

There are many reasons why you might need to know your MAC address or at least know how to find it. I’ll cover a couple of those reasons in another post.

Open Command Prompt As An Administrator In Windows

This post describes how to open a command prompt with full administrator permissions in the following Windows Operating Sytems:

Windows 7, Windows Essential Business Server, Windows SBS 2003, Windows SBS 2008, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2, Windows Server 2008, Windows Server 2008 R2, Windows Vista

 

To open a command prompt as an administrator,

1. Click Start, click All Programs, and then click Accessories.
2. Right-click Command prompt, and then click Run as administrator.

If the User Account Control dialog box appears, confirm that the action it displays is what you want, and then click Continue.