Bash history is very powerful. You can also manipulate how it works by setting shell options. You can have the shell ignore any line that starts with a blank space. You can also have the shell ignore duplicate entries.
- [Instructor] There might be times when we don't want…to add commands to our command history, in this case…we can set a shell variable called HISTCONTROL,…type in export space, HISTCONTROL, all uppercase letters…equals, ignore space and hit enter.…Let's test this by placing a space before the history…command and see if it shows up in the history.…Type in space, history and hit enter.…We can see that the history command is not recorded…in the history file.…Any time you don't want a command polluting your history…file, just prepend it with a space, this is a simple way…of keeping your history clean.…
Another value for this option is ignore dups.…Type in export space, HISTCONTROL, equals ignore dups…and hit enter, ignore dups won't record duplicate entries.…Let's type in ls three times and check the history.…Ls enter, ls enter, ls enter, now let's type in…history and see the result, we only see one of the ls lines.…This doesn't however get rid of previous duplicates.…
To get rid of all duplicates, including those in the past,…
- Topics include:
- Shell tips and tricks
- Pattern matching with globs
- Pattern matching with extended globs
- Using the Bash shell
- Monitoring processes using ps
- Monitoring processes graphically
- Managing processes
- Job scheduling
- Limiting access to AT and cron jobs
- Managing system services
Skill Level Intermediate
Linux: User and Group Managementwith Grant McWilliams1h 8m Intermediate
1. Linux Shells Overview
2. Using the Bash Shell
3. Linux Processes
4. Job Scheduling
5. System Services
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.