Mailinglist Archive: opensuse (958 mails)

< Previous Next >
Re: root-history - was: Re: [opensuse] Where to set the domain name? - Leap 15.1 beta
On 05/07/2019 01:34 AM, Simon Becherer wrote:
Am 07.05.19 um 07:02 schrieb David C. Rankin:

Looking at root's history on 15, it looks like I set the hostname with the
domain component with hostname, but I have no record of what I put in the
other...

5 2018-04-13 03:21:20 hostname vlleap15.3111skyline.com
6 2018-04-13 03:21:34 vi /etc/hostname
7 2018-04-13 03:21:53 vi /etc/hosts


hi david,
how to get a root history?
i know only the file bash_history, but i think you have some different?

simoN


Simon, the 'history' command shows the users current history. If you want
root's history, you su to root and type history.

But like anything Linux you can always tailor it to your needs. I don't like
typing and when I want to look at history, I ususally want to look at
something specific. So instead of having to type 'history | grep "whatIwant"'
each time, I add a simple function and alias to my .bashrc, so all I need to
do is type 'hist whatIwant'. The function and alias are:

showhist() {
[ -z "$1" ] && { printf "usage: hist <search term>\n"; return 1; }
history | grep "$1"
}

alias hist='showhist'

I generally create a function that gives some usage information if I just
type the name and forget to type the required arguments. Better yet, you would
have it respond to '-h' or '--help' as well :)

--
David C. Rankin, J.D.,P.E.

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse+owner@xxxxxxxxxxxx

< Previous Next >
This Thread