As we go along with our daily linux routines, be on server or with our power desktops, we could think and backtrace a specific command that we just keep on forgetting.
Linux history command reminds us the past linux command done by a specific user. By default, without any parameters, history list out all the commands entered by the currently logged-in user regardless of the command has been successfully executed or not.
Issued as root, this would show you root history commands in numbered format.
# history
Clearing out which is not really a good idea:
# history -c
Try clearing it out and show the history commands again like so
# history -c
# history
This would show you the history line marker and the last linux command issued by the currently logged-in user.
Moreever, these list of history commands refer to /root/.bash_history if you are using root. It follows the format of ~username/.bash_history by default. So vertito user has ~vertito/.bash_history file.
However, be reminded that this history file can be forged, edited, deleted, and most likely be purged. Additionally, the maximum number limit for history lines can also be modified using bash environment when a user logs in with his default bash profile. Not to mention, size of the history file could also be restricted to a certain file size.
Below are the basic variables related to setting history setting from bash profile.
USERNAME
HISTFILESIZE
HISTFILE
HISTSIZE
HISTCONTROL
Example additional contents of .bash_profile with regards to history linux command:
HISTSIZE=2
HISTCONTROL=ignoredups
HISTFILESIZE=4
This means, the maximum number of history lines would be 2 lines, ignoring any duplicate commands with a maximum filesize limit of 4 Kbytes only.
More arguments / option for history command :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-c Clear the history list by deleting all the entries.
-d offset Delete the history entry at position offset.
-a Append the ‘‘new’’ history lines (history lines entered since the beginning of the
current bash session) to the history file.
-n Read the history lines not already read from the history file into the current
history list. These are lines appended to the history file since the beginning
of the current bash session.
-r Read the contents of the history file and use them as the current history.
-w Write the current history to the history file, overwriting the history file’s
contents.
-p Perform history substitution on the following args and display the result on the
standard output. Does not store the results in the history list. Each arg must be
quoted to disable normal history expansion.
-s Store the args in the history list as a single entry. The last command in the
history list is removed before the args are added.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Take note that "history" is not a binary file, not like echo, it's a builtin bash command from bash shell.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
July
(107)
- AMSN messenger install howto
- firefox browser - yum update howto
- kopete messenger install howto
- Gaim pidgin messenger install howto
- xmms - multimedia player install howto
- UltraDMA - speedup your harddisk howto
- sabayon - user profile manager howto
- 50 quick linux command tips part 3
- No negotiations with Microsoft in progress
- connect SamSung D820 mobile to linux howto
- yum from ISO image or CD install howto
- missing portmap reinstall howto
- 50 quick linux command tips part 2
- 50 quick linux command tips part 1
- desktop wiki install howto
- NASA tests Linux for spacecraft control
- warzone 2100 strategy 3d game install howto
- motd - message of the day
- more with kernel name version howto
- stop and start networking service howto
- change network proxy preference howto
- alexa firefox toolbar plugin install howto
- reboot / halt system via CLI howto
- gparted partitioning install howto
- google picasa install howto
- pine and pico install howto
- adobe/macromedia flash player test and install howto
- realplayer install howto
- Microsoft's TrueType core fonts install howto
- Why Choose Fedora? (Fedora vs. Ubuntu)
- Microsoft vs Opensource
- the df command
- linux possessed by monsterz
- change display setting howto
- NTP clock synchronization howto
- qtparted partitioning magic install howto
- host name and host aliases explained
- IP aliasing - virtual IP howto
- viruskiller on linux
- change keyboard language setting
- changing ethernet card settings howto
- TIP: WiFi with chillispot and linux
- play tennis the linux way
- sudoku game install howto
- my linux box talked to me
- CD/DVD burning software install howto
- A SYSAD BLOG - LINUX: list out active host connect...
- list out active host connection howto
- more with linux command named history
- GnuPG and enigmail thunderbird add-ons
- PDF file readers install howto
- digikam - KDE photo management install howto
- gnome floppy formatter
- f-spot Gnome photo manager install howto
- VLC media player install howto
- ping IP subnet block howto
- TIP: find and delete files recursively
- list out opened host ports howto
- TIP: linux process priority scheduling management
- TIP: spammer sending email using squid
- remount partition as read only howto
- additional swap file howto
- CrossOver install howto
- system-config-securitylevel-tui and lokkit howto
- format a windows partition from linux hadrdisk
- TIP: monitoring while mounting USB devices
- zero-sized a file without permission / ownership c...
- TIP: auto create mail spool when adding user
- md5sum checksum howto
- IP address to country lookup howto
- gnome mail notification install howto
- add new harddisk to existing linux system
- TIP: block an IP address
- disk space report
- more trace route command alternatives
- changing your hardware / software clock howto
- other interesting ping commands
- send email via CLI howto
- adding static route howto
- send message to all logged in users
- unzip zip untar tar bzip2 bunzip2 gzip gunzip file...
- format of /etc/passwd, /etc/shadow and /etc/group
- remove user's cron jobs howto
- find the user's files howto
- passphraseless + passwordless ssh howto
- passwordless ssh howto
- X11 Forwarding via ssh howto
- skype install howto
- disable IPv6
- lsusb - list all USB devices
- make yum faster
- lspci - list all PCI devices
- kill a process
- beginners CLI guide for static ip address
- the pidof command
- retrieve data from mysql using bash script
- VirtualBox install howto
- call bash script inside php web page
- alternative linux browsers
- last / currently logged in users
-
▼
July
(107)
Wednesday, July 18, 2007
more with linux command named history
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment