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
Learning Linux Command Line (2016)with Scott Simpson1h 38m Beginner
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.