Linux Crash Course - Bash History

preview_player
Показать описание
Bash is the default shell in the majority of Linux distributions, and it has countless features and tricks to make you more efficient. Bash keeps a history of the commands you've typed at the prompt, but most people aren't aware of additional functionality that the history provides you. In this episode of Linux Crash Course, Jay describes not only how to use the history command, but also some techniques to make better use of it.

*🐧 Donate to Learn Linux TV and Receive a PDF with tips for switching to Linux*
Contains over 40 pages of tips and recommendations to help make your transition easier!

*🐧 Get an Awesome Linux Command Cheat Sheet*
For just $3, This brand-new PDF cheat sheet features all the commands you should know, as well as some of Jay's favorite aliases and tweaks!

*💧 Spin up some Linux Servers with Digital Ocean*
Digial Ocean is a great way to quickly spin up some Linux machines!

*🐧 Support Learn Linux TV*
_Note: Royalties and/or commission is earned from each of the above links_

#*⏰ TIME CODES*
00:00 - Intro
00:59 - Get your very own Linux server with Linode (sponsor)
02:15 - Running the history command
03:56 - Re-running a command from the history
05:43 - Re-running a command and prefixing it with sudo
06:33 - Setting up bash history to show the date and time of each command
08:32 - Ignoring history entries that begin with a space
10:17 - Viewing a specific number of history entries
11:58 - Searching the command history via CTRL+r*🎓 Full Linux Courses*

*🎓 More About Learn Linux TV*

*⚠️ Disclaimer*
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws.

#Linux #Bash #LinuxCommands
Рекомендации по теме
Комментарии
Автор

CTRL+R moves backward through matched commands at 12:25. We can also press CTRL+S to move forward through them, in case we pressed CTRL+R too many times. Trouble is, in many terminals CTRL+S suspends/locks it. (CTRL+Q resumes it.) This suspension is rarely useful IMHO. So we can run "stty -ixon" to turn it off. It tells the terminal not to intercept presses of CTRL+S, allowing them to reach bash. Also "ALT+SHIFT+, " and "ALT+SHIFT+." move to the first and last items in your history respectively. Good content as ever 👍

markhawkes
Автор

Loving the beard keep up the great content I’ve learnt so much from your channel

Chris-tbjh
Автор

Ur 3rd edition book made it today, Awesome!

ykkim
Автор

I think you should discuss about how history is per user as well as per terminal instance.
An example:
If you have two terminals open and both logged into the same user you would have different history if you run commands in both windows. If you close one terminal it does not merge the history. I am not sure how to handle this annoyance but I know it exist.

danielbjohnson
Автор

people like You change the world :) I appreciate all Your work!

PCMagik
Автор

Love your channel best Linux channel I’ve seen

okekeebube
Автор

Aargh I've been using Ctrl+R for actual YEARS and never even knew what it actually does 😭
Thanks for explaining it 😍

marlene
Автор

Hey! Thank you very much for your work! I don't understand English well, but your guides are the best. And I just want to say that your audience will grow more and more every day, because the new time simply requires it.

elinaskytexts
Автор

Great video. Keep it up. Would love to see you cover things like AWK, SED, XARGS, unless you did already

syriangamer
Автор

Great video as usually! If you need to delete some exact line in history file use history -d number_of_line, or if you need to delete entire history use history -c. 🤓

salepopovic
Автор

you don't have to log out to see dates after the bashrc file you can just type source .bashrc and then history will use the new parameters

Ranblv
Автор

wicked!! :-D what a great insight into a command that we all know - but with totally useful twist. I really appreciated all the insights that you provided here. Keep it up!!

Acilius.
Автор

thanks just added the date and time to my history output

slalomsker
Автор

This one yields a lot of fruit. Remarkably helpful.

Factory
Автор

Hello, thank you very much for this video and all you content in general, i want just to ask question and i have proposition,

mossaabboudchicha
Автор

Ha!, I knew about the ctl+R though a little bit by accident but I did it anyway lol there is a short cut button top of your keyboard. I cannot apt-get update nor upgrade my terminal on pine phone... denied http://... and I havent solved it yet so... Very handy indeed and super useful. Thank you, sir, appriciate your series a lot.

hamatawah
Автор

Brilliant, I get the best commands from you. Commands that change the game for me.

odindio
Автор

Hey there! i'm using bash from Vscode as my default terminal. But when I close Vscode or kill the terminal without 'exit' command, i loose my history. How can i fix that?

tomasbuzeta
Автор

Very helpfull. Anyone knows how to set time stamp for the history but without editing the profile, I manage several servers so...
Also, I would like to know if there is way see not just the command but also the actual output of that command

warnerren
Автор

CTRL+G will gracefully quit the history search (as opposed to ungracefully using CTRL+C)

WillKohut
visit shbcf.ru