AboutWelcome to Free Software Daily (FSD). FSD is a hub for news and articles by and for the free and open source community. FSD is a community driven site where members of the community submit and vote for the stories that they think are important and interesting to them. Click the "About" link to read more...
When invoked without arguments, the date command displays the current date and time. Depending on the options specified, date will set the date and time or print it in a user defined way. I’ve seen many people writing a perl script for calculating yesterday or tomorrow. Computer loves numbers but we love relative terms like 2 days ago.
The bash shell maintains a history of the commands you entered. You can re-execute a command by recalling it from the history, without having to re-type it.
" Let me teach you how to work efficiently with command line history in bash. This tutorial comes with a downloadable cheat sheet that summarizes (and expands on) topics covered here (scroll to the end for a download link). In case you are a first time reader, this is the 3rd part of the article series on working efficiently in bourne again shell. Previously I have written on how to work efficiently in vi and emacs command editing modes by using predefined keyboard shortcuts (both articles come with cheat sheets of predefined shortcuts)..."
Bash / CSH shell offers command history feature. Most of you may be aware and using of UP / DOWN arrow keys to recall previous commands. History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous ommand into the current input line, or fix errors in previous commands quickly.
The Bash shell is the default shell environment in most Linux distributions, including all flavours of Debian. One default feature of the Bash shell is to record a history of all the commands entered by a user in a log file called .bash_history, found in the user's home directory.
"When you are working in a shell you certainly don’t want to waste your time using arrow keys or home/end keys to navigate around the command line. One of the most popular shells, bash - Bourne Again SHell, uses GNU’s Readline library for reading the command line. The GNU Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. The readline library also includes functions to maintain a list of previously-entered command lines, to recall and perhaps reedit those lines, and perform csh-like history expansion on previous commands. Both emacs and vi editing modes are available.
Anybody who has used the command line extensively to navigate, understand and configure GNU/Linux will know that in the course of a few months’ work it is possible to build up an extensive history of used commands. This necessitates some pro-active management to get the best out of it. Here are some tips to make the most of the history command.
Type history at the Bash command prompt, and you'll get a list of your previous commands. You can navigate through these with the up and down arrows, but there are other ways of interacting with them that I've been investigating this week.
You are probably familiar with common keyboard sequences like Ctrl-C to end a program, but there are dozens of useful shortcuts you can use in BASH to edit the command line, move around your command history, and control jobs. I've collected 18 useful Ctrl and Meta (Option) sequences to make you more productive in BASH.