I was watching a video last night that had good content but before it was done the looping background music caused me to stop it. Half the comments were a complaint about the music too. So it wasn't just me. I'm not saying background music is always bad, but it is not easy to get it right.
'Hello my name is XXXX XXXX welcome to my channel. Today I'm going to show you show to XXXX. I hope you like the video. If you do, click the Like and Subscribe button. Well, enough talk, lets dive into it!! *** 10 secs of intro music *** Do you also have the problem that XXXX? Sometimes you think XXXX and you dont know what to do? There is a way out of this problem! *** Actual video content *** More or less like that, every damn youtube video.
This right here is very underrated. Assholes forcing 10 minute videos for ads and just fills them with useless thoughts no one wants to hear or care about.
Very precise. No BS introductory talks. Information dense. No interrupts. No distracting elements on the video or the narration. Extremely well made. Love this format of yours. Keep 'em coming.
Most of the "x things you didn't know" videos are shit. Regarding Linux, I know that there way waaaaay more things than 8-9, that I know, so it's safe to check it out. I ended up knowing 1.
I normally don't comment, but I have to say just stumbling onto your channel and this video changed the very tone of my night. I went from wanting to relax and be unproductive to wanting to hack away more on a Linux terminal in the late hours and discover more hidden gems. Seriously this is great content I'm sharing with all my coworkers and programmer friends alike.
8:11 I'd recommend a terminal multiplexer such as gnu screen or tmux for such use-cases. Not only will it continue running all your processes when you detatch (or the connection fails), but when you come back, you will see everything the same way as you left it (if you didn't restart the machine). Moreover, it allows you to have multiple screens and multiple sessions in only one window. It's an incredibly useful tool especially for ssh connections.
2:50 This is controlled by the HISTCONTROL variable in Bash. You have options to ignore commands with leading blanks, ignore duplicates, and even erase duplicates before inserting a new entry. There is also HISTIGNORE for more fine-grained control of which commands go into the history list.
It might be worthwhile to mention that you can control the editor program to use for ctnl+x+e or fc with exporting the environmental variable EDITOR, e.g.: export EDITOR=nano
I was looking for this comment. I got an error saying, "emacs: command not found", and assumed there was a default editor set. (I'm a vi user). $ EDITOR=vim did the trick.
Great video. Hands-down helpful with no stupid click-bait title! Love that. I also love that there are dozens of other helpful commands in the comments!
This is about the best video *ever* on the premise "Commands you probably aren't using" - totally taking notes and will be invoking these, most DEFINITELY!
Got to admit, most of these commands I didn't know about and I've been using Linux for over 20 years! Subscribed! Can't wait for the next RUclips installment
Thanks for this. The use case for "disown" reminded me of another useful command that is the "screen" command, which allows us to have multiple sessions using the same terminal. We can get in a session, start some code, get out and things will run in background; and later, we can resume the session.
I was Linux, he a -nix We root systems made of X He wore Spark, and I wore ARM He would always win the stack Bang bang I shut him down Bang bang He bit the Grub Bang bang Systemd shut us down
Dude that’s great, I’m an old man restarting on Linux world and loads to learn, bg, exit from terminal and leave running I’ve tried the rest just saw it briefly. Tks dude and the format is really good, doesn’t cover the screen and ur presence doesn’t cause any inconvenience at all. Congrats man 👏🏼👏🏼👏🏼
when you know before that you'll be gone until it finishes - yes. But normally you don't work *always* in screen and friends - then disown is perfect when boss wants unscheduled meeting right now and you need your laptop in the meeting room, i.e. disconnect - but that build is running, having spawned subprocesses ....
I use tmux on commonly used systems, but there have been times where I touch systems I don't own/maintain and I think this command could be useful (just found out about it).
Well, these are not commands but are useful tips: 1) Ctrl+t, if you need to swap last two typed letters, i.e. "daet"->"date" 2) To correct a mistyped executed last command without rewriting, i.e. you typed "daet" and pressed enter. You can fix it this way: ^et^te, press enter and see the results (obviously this suits better with long commands). In short: ^(wrong)^(right) Just for clarity, one more example: You executed "sotr". You fix it executing ^tr^rt.
1st time viewer! Nice video! I've used 5of9 of the commands. Those fc and disown are new to me and are pure gold! Thanks for that. If anyone is interested: More info on those two commands can be found with $help fc or $help disown where $ is means the prompt.
I have used 2 of these regularly (#3 and #8) when creating automation build scripts. I was always trying to speed up portions of the build and would try to farm out disk-intensive tasks to virtual RAM disks whenever possible. Being able to partition output from different parts of the build to different logs would not have been possible without the tee command. I plan to try to use more of these techniques.
You do not need to create a ramdisk under linux, just use /dev/shm directly. Fully POSIX compliant, you will not know the difference from a regular Ext4 FS. In essence mount -t tmpfs tmpfs works pretty much like mount -o bind :)
@@MichaelMantion Yes. SHM stands for SHared Memory. www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html THO! Unlike on that page, i don't think you need to mount it specifically, i cannot recall ever doing that.
@@MichaelMantion Checked, Ubuntu based distros auto mount it by default, but i recall years ago using on Debian we didn't even mount it and it was available as it is a device. Might be that the mounting thing is more of convenience type of thing (easy clearing and assurance to end user)
@@skaltura kernel configurable. You're eating your system semiconductor ram to use it, so if you're on a low memory system compared to useage needs - you might consider a disk based option ...
This is true for linux, but what abut Solaris, or HP(s)UX (do hey still exist) or any of the other unixen out there? Do the embedded unixen all have /dev/shm? It's worth understanding what's going on. Besides I believe the /dev/shm is often just the result of an fstab entry, so it's really just the same thing as what the presenter said.
Great video. To the point and super informative. I'll probably use at least half of these moving forward. The only one I knew was the creation of folders using the curly braces... Please do more! And thank you!
#1) This is simply your shell's built-in history substitution function, and it's always among the first things I disable ("set +H" in bash), because it makes typing anything with "!" in it an incredible PITA. You have to backslash-escape the ! _every time it appears_ (it ignores quoting), or else it will simply shove the previous command right inside your current one. It's not really any harder just to up-arrow to the last command and hotkey jump to the start of the line. It's also easy to use +r,+s> history search for older commands (made even easier with the fzf plugin). That's just my personal preference, however. See the HISTORY CONTROL section of the bash manpage for details on manipulating your history. #2) In bash, this is the emacs-style keybinding. With vi-mode enabled (set -o vi), the key is 'esc+v' (esc to get into normal mode, a-la vim). The shell will use the value of the $EDITOR environment variable as the editor to use. #4) In bash, this behavior is controlled by the HISTCONTROL variable. With the value "ignorespace" it acts as described in the video. I also add "erasedups" to mine, which makes it remove all older copies of the command, and only the newest one remains. "ignoredups", the last option for this variable, is basically the opposite of erasedupes; it will not add a command to history if it already exists, so that you keep the oldest entry. You can also set globbing patterns in the HISTIGNORE variable, and it will not add anything that matches those patterns, good for commonly used commands like "ls" that you don't want cluttering up your history. See the "Shell Variables" section in the bash manpage for details. #5) This is essentially the same as "up arrow + #2". fc is a shell builtin command for accessing and controlling your history list. Type "help fc" in bash or find its description in the manpage. I also highly recommend setting the histreedit shell option, so that it puts your chosen history command back on the readline for editing, making you less likely to mistakenly re-run an old command (e.g. "rm -rf *") as-is. Again, I also use vi-mode, which offers a lot of the same movement and editing commands as used in vim (jumping between words, etc), making it easy to do fairly complex editing on the command line (not that the default emacs-mode is any less capable, but I find the workflow and the hotkey bindings to be less intuitive). #7) Brace expansion is very convenient, especially for creating numbered lists of things. I just want to caution that you should keep its usage separate from that of globbing ([^]*?) patterns. While globbing only _matches_ files or text strings that already exist, braces _generate_ (expand into) lists of strings before executing the command. e.g. "ls [fgh]oobar" will list out the files "foobar" and "hoobar" that exist in the directory, and ignore "goobar", which doesn't. On the other hand, "ls {f..h}oobar" will expand and execute the command "ls foobar goobar hoobar", resulting in a "no such file" error message on "goobar". Note also that numbers can be zero-padded, and negative and descending range lists also work. They can also be combined and nested (e.g. "echo foo{{1..5},{a..e}}bar"). Finally, also be aware that brace expansion happens _before_ variable (and other parameter) expansions, so actions like "a=1 ;z=10; echo {$a..$z}" do not work as you would expect. #8) That's a bit of a confusing explanation for tee. What tee does is fork its input into two parallel outputs, one channeled into a file, and one going to stdout. This allows you to monitor, duplicate, or redirect the output from the middle of a chain of commands without interrupting its operation. "info tee" will give you a detailed description. #9) disown doesn't have to be used only when exiting. You can "remove" an unwanted process from the shell at any time. A common pattern is to "" to suspend a running foreground process, then "bg" to resume it as a background process, then "disown" to fork it away from the current terminal. Note that it's impossible to get it back again once disowned. You can only terminate it or send it other control signals (with the "kill" command or similar). Re the "JOB CONTROL" section of the bash manpage for details. Some people recommend the use of screen or similar multi-terminal applications for better background process management.
I didn't know ctrl+x+e or fc - nice But then again - if running bash and tying 'set -o vi', you turn bash into vi mode, meaning ctrl+x+e is simply kv (or just v to access the editor from command mode). fc works well with vi too last I tried - I guess it just uses EDITOR or whatever's the default on your system. The rest was well known stuff.
Add "conv=fsync" to your dd command, which flushes pages to disk after dd has finished writing. Otherwise you're writing to pagecache (which is RAM anyway) and will get imprecise results.
Great video , just to add one minor details : The ctrl+xe is a feature of the readline library used by the bash shell and so works only on bash shell. Other shells like zsh do have an edit-command-line wigdet but you need to configure in your .zsh . # Enable Ctrl-x-e to edit command line autoload -U edit-command-line # Emacs style zle -N edit-command-line bindkey '^xe' edit-command-line bindkey '^x^e' edit-command-line # Vi style: # zle -N edit-command-line # bindkey -M vicmd v edit-command-line
It it then necessary to share the rest of the useful commands: - suspend the current process (I use this to suspend Vim to run tests in the same window): ctrl+z - list processes: jobs - foreground one of the options listed in jobs: % - foreground the most recently suspended process: fg EDIT: 12/23/18 - change background to suspend
Amazing! That Folder command was mind blowing! I started to learn Linux a few week back and also am encouraging First year graduates to learn Linux too!! Will share this video later on with them!
Also saves in bash history in expanded form so when you use the up arrow for recent commands it doesn’t say “Sudo !!” like you actually typed it it shows the whole effective command.
@@cartersherman925 !! just basically replaces itself with previous command. Example if you typed ls as first command, then you can do the following: sudo !! -al to do sudo ls -al
4:32 Couple more things worth clarifying about this command: 127.0.0.1 is the loopback address, so you can have services listening on this address without exposing themselves to the outside world. Also the “-N” option causes ssh to make the connection without doing anything else, like displaying a shell prompt. Instead of backgrounding it with CTRL/Z and then “bg”, you could have just stuck a “&” on the end of the command.
Been a linux user since 2012 and taught myself how ls -l works. Very useful and handy command. So glad to see that this is being spoken out and recommended by an engineer along side of other commands I never heard of.
Here’s another one: “mmv” to do bulk renames of files, e.g. mmv «old-pre»\*«old-post» «new-pre»\#1«new-post» will rename all files with names beginning with «old-pre» and ending with «old-post» so they begin with «new-pre» and end with «new-post», keeping the part in the middle the same. This command can be quite dangerous if you get it wrong. So if you try it first with “mmv -n”, it will tell you what it would do without doing it. Then when you are sure you’ve got the patterns right, change the “-n” to “-v”, and it will go ahead and do it, and report what it has done as it goes.
2:36 tip 4: make sure you have the environment variable HISTCONTROL set to "ignorespace" or "ignoreboth" for this to work. export HISTCONTROL=ignoreboth 5:03 tip 7: I think this requires the shell option extglob to be set, but maybe newer versions of baah (bash>=5.x) don't require this now. I double checked the man page and it didn't specify, so might not be required, but extglob is another really cool feature of bash! shopt -s extglob
Ah, Vim :-). Attempting to understand your example: User finds ':w' won't work. Permission denied. Instead pipe all the editor's content into 'sudo tee %' (the '!' executes a shell command). That will overwrite the currently open file since '%' in that command line context will be replaced by the current file name. At least this feels sensible.
@@kevinbillingsley8256 , vim has a certain learning curve. Once a certain point is passed it proves to become quite the swiss army knife and very versatile. Myself, I am using it for about 20 years now virtually every day at work, am happy, and sometimes enjoying the text-adventure that also is vim. Recommend vim to fellow nerds (e.g., people watching videos like this one). Just do not badger the non-IT people and you are socially fine. Btw. nothing against nano. IMHO any Linux fanboy ought to bring nano basics if only for the fact that it seems to replace vim as the default onboard command line editor. Meaning, a fresh Linux will probably already have nano available where vim still would need being installed.
3 года назад+1
You can also type Ctrl+X+E when you have a long command in terminal. It will also open the editor to edit the long command, like fc.
Thanks for that! You shouldn't rely on the "leading space" method tho, if you want to guarantee commands don't make it into history you can always ' unset HISTFILE '
Been a Linux guy for 20 years, this is a good video that covers some good basic things. I would suggest covering basic output redirection, tmux, Ctrl+r bash command, lspci and package management hacks.
In Linux sure. On other unixen too? Anyhow, I'm also wary that I will fill up /dev/shm and forget, thus causing the machine to start to thrash. SSD are a better answer -- and not that expensive.
Usually these lists consist of 75 % stuff like "ls -l" and take 62 minutes to come to the point. All these commands I didn't know of and it was quick and to the point. Thanks.
I didn't know about "disown". I'd use "screen" for this purpose since it allows re-connecting to a running shell later. I don't use "fc" since I have "set -o vi" set in my shell, so Esc, v does the same thing. I've never had need to use a RAM disk (other than the initrd). What's your use case for RAM disks from the command line? Thank you for this video. I think it's a good idea to find obscure & useful commands that get forgotten over time.
Ramdisks can be useful in some (but not very frequent) workflows. Example: ETL Extract Transform Load. Extract to Ramdisk, do whatever you must do, load from ramdisk. If the transformation part is long you'll start loving Ramdisks .
When I did some data manipulation for deep learning, I had to transform my data set into something more sensible to be used for training, did a small python script for it, but due to the amount of data, it took a few minutes to run, this could have helped me reduce the time by a lot.. I could also have reduced the complexity of the script but not without a few hours of work, so not worth it
Lawrence D’Oliveiro I don’t use it a lot since I don’t work that much with remote machines and I got I3... I know there are some other features that screen has but i3 doesn’t but I still prefer using i3 over screen for tiling terminals...
Thanks for this video.. Really didn't know about "sudo !!" so far.. I had already days where this command could have saved me time to go for 2-3 extra coffes :'D Yeah the video format is awesome and I would love to see similar videos in the future! Really appreciate your work!
For the last one with disown personally I use tmux or screen this way you can still re attach and have input output available for the command. Nice commands even though I use them all keep up the good work 👍
0:45 Arrow up, Home "sudo ". Same number of keystrokes. 1:10 Pretty useful. 1:23 SSDs have *pretty much* obviated the need for this. 3:32 How is this *better* than using the up arrow? 5:06 Also useful. 7:00 A competent OS should not need this. Older systems (like OpenVMS) have a rich batch job system for long-running processes.
Awesome format. I’m not new to terminal commands, but I’m now to the Linux distros. Im enjoying them. Good stuff Edit: My comment doesn’t make sense. I’m now to Linux, but not new to using terminals. Edit #2: editing for *1st Edit:* comment: *new* to Linux...
I like to use pushd/popd in addition to cd when manipulating directory trees (this might be long for clarity). pushd creates a stack of directories that can be manipulated so any directory in the stack can become the cwd. The stack can be viewed by 'dirs'. I find this incredibly useful when having to move between several directories (context switching, switching between source code an log directories, 'one of those days' when everything is on fire and I don't want to remember what directory I was in before being pre-empted by the latest fire drill, etc). Example: directory structure: ~/foo/bar/src ~/foo/bar/log ~/foo/bar/baz # Start at ~/foo/bar/src cwd: ~/foo/bar/src ------------------------------------------------------------------------------------- # Change cwd to ~/foo/bar/log $ pushd ~/foo/bar/log ~/foo/bar/log ~/foo/bar/src # Check directory stack $ dirs -v 0 ~/foo/bar/log 1 ~/foo/bar/src ------------------------------------------------------------------------------------- # Change cwd to ~/foo/bar/baz $ pushd ../baz ~/foo/bar/baz ~/foo/bar/log ~/foo/bar/src # Check directory stack $ dirs -v 0 ~/foo/bar/baz 1 ~/foo/bar/log 2 ~/foo/bar/src ------------------------------------------------------------------------------------- # Switch the top 2 values of the stack by issuing pushd without any values $ pushd ~/foo/bar/log ~/foo/bar/baz ~/foo/bar/src # Check directory stack (cwd is now ~/foo/bar/log) 0 ~/foo/bar/log 1 ~/foo/bar/baz 2 ~/foo/bar/src ------------------------------------------------------------------------------------- # The numbers on the left of the dirs output are index values for the stack so now we can # change cwd and alter the stack by index. $ pushd +2 # index 2 of the stack changes cwd to ~/foo/bar/src ~/foo/bar/src ~/foo/bar/log ~/foo/bar/baz
One downside of this is that you need to use pushd when you start. Sometimes you forget to, or don't know you'll need it. A different usefil trick is "cd -" - it goes to the last directory yuo were in. It can't be used to backtrack several steps, but it's good for switching between two locations quickly and frequently.
Thanks for sharing, the ones new to me were: * Ctrl+x+e * fc * disown -- though I am using nohup explicitly when I want something to stay alive; or, even better, run it inside screen/tmux if I plan to come back later on And here is one for you: instead of using ps aux | grep (which runs an extra costly regexp grep) simply to a ps -FC in case you know the command; it uses the built in command matching instead of spawning grep as a second process; and if you cannot live without grep, please use fgrep (fast grep) -- this does not care for regexp and only does string matching -- way faster ;-)
Bruh. This is a great way to rep Linux! Well done. It’s full of obscure (to me) and useful (to a bunch of folks) commands, it’s funny, and it seems shorter than it is. Right on. Thanks for your work. Also, you could show some Windows users and they’d think, “Hmm, that’s handy.”
Thank you! So many commenters here need to learn how to use their keyboard first, apparently. It's also safer because you always know what you're running as root instead "what ever the last thing I said because there are no consequences to my commands." Might as well use "sudo -s".
@SaltyBrains Using Putty (Windows), when I CTRL+A I get ^A. When I try the home key, it capitalizes the previous character. This is using the bash shell in Fedora 27. sudo !! works without dealing with this crap and I'm not a fish -- I can remember the last command I just typed.
sudo !! : I use ctrl+x+e : I didn't know about, will probably use ramdisk : I didn't know about, will may use if the situation arises, good to know about no history : I use fc : I didn't know about, will probably use ssh -L : use regularly bash curly brace sets : I use tee : I remember it now that you show it. Will probably use. disown : good bonus, saved the best (for me) for last Cheers!
0:19 The main use I have for “sudo” is “sudo /bin/bash”. Then I can do any number of things as root. Or, I dedicate a terminal window/tab to root operations with “exec sudo /bin/bash”. Then when I hit CTRL/D to logout, there is no non-root shell to go back to, the terminal window/tab simply disappears.
@@Chr0n0s38 “su” requires the root password. If root doesn’t actually have a password, that won’t work. And “sudo su” seems kind of pointless -- use either sudo or su, not both.
@@lawrencedoliveiro9104 I stand corrected, it appears to be safe however each method of obtaining root actually puts you in a different state. For example `sudo su -` and `sudo -i` both behave like a full root login. `sudo /bin/bash`, `sudo su`, and just `su` all call the root .bashrc, but nothing else. askubuntu.com/questions/376199/sudo-su-vs-sudo-i-vs-sudo-bin-bash-when-does-it-matter-which-is-used
I know this is meant for Linux, but that "sudo !!" command also works on mac! I didn't even know something like that existed! The amount of times I've run commands, only to forget that they require root, is more than the grains of rice I've ate in my life.
@@deadinternet66 It is, it's just that I didn't find out about these commands before, and some commands require installing packages on macOS using brew, which is why things like this surprise me since I didn't need to install anything beforehand. I've changed my default shell to zsh, no difference in commands whatsoever, I just like the sub string search functionality :)
@@handsomepixel5193 I also use zsh as my shell on both macos and linux. You should checkout oh-my-zsh if you're a zsh fan. github.com/robbyrussell/oh-my-zsh
@@deadinternet66 I've used oh-my-zsh before, but it was too much "zsh power" for me too handle. The plugins were nice, but I wanted a simpler and faster setup, so I instead downloaded the individual plugins myself and auto-source them through my .zshrc I use zsh-syntax-highlighting and zsh-async-git-prompt, and I consider that enough for now.
Dude, im super excited for this video. I understood everything but have no practice using linux. Normally I get over explabored but you hit the mark with the pace and interesting content.
Wow. I’ve been using Linux since RedHat 4 and I can honestly say that I have only ever heard of two of those juicy tidbits. Thanks! All of them were extremely helpful and I’ll be incorporating them in my day to day now.
I just loved the way how to use ramdisk for very fast file i/o.. This would definetly help me in future..thanks and make more awesome linux/python tutorials...all these small videos you make actually teaches me alot. Thank you again and excited for more videos... :)
Oh yeah, love tab when typing long file names or can’t remember how to spell something. Works at a CMD prompt on that other OS that should not be named. Lol. Slightly different though, sequences through all files that match. Use tab in vi on command line as well to fill out a file name.
@@Uneke I meant love it on Linux. Just happened to note what it does under the cmd prompt. I thought since this seems to be a Linux video, I thought I would make a joke vis a vie Voldemort/ Windows.
You may export the EDITOR environement variable to use any editor instead of emacs echo 'export EDITOR=nano' > ~/.bashrc && source ~/.bashrc and then Ctrl x+e will launch nano
I am putting all off these on a list next to my screen, these are super useful! I also didn't know the bg command so now I have learnt 10 new useful commands!
Finally! A RUclips video with content straight to the point, no useless babble, no unnerving background music.
I was watching a video last night that had good content but before it was done the looping background music caused me to stop it. Half the comments were a complaint about the music too. So it wasn't just me. I'm not saying background music is always bad, but it is not easy to get it right.
'Hello my name is XXXX XXXX welcome to my channel. Today I'm going to show you show to XXXX. I hope you like the video. If you do, click the Like and Subscribe button. Well, enough talk, lets dive into it!!
*** 10 secs of intro music ***
Do you also have the problem that XXXX? Sometimes you think XXXX and you dont know what to do? There is a way out of this problem!
*** Actual video content ***
More or less like that, every damn youtube video.
Amen!
This right here is very underrated. Assholes forcing 10 minute videos for ads and just fills them with useless thoughts no one wants to hear or care about.
You guys must be fun at parties :P
Very precise. No BS introductory talks. Information dense. No interrupts. No distracting elements on the video or the narration. Extremely well made. Love this format of yours. Keep 'em coming.
I am always doubtful of videos claiming "....you probably aren't using". But, this video did not miss its mark! Thanks for the info.
Most of the "x things you didn't know" videos are shit. Regarding Linux, I know that there way waaaaay more things than 8-9, that I know, so it's safe to check it out. I ended up knowing 1.
I use most of those daily. I must be a super hero then...
@@dingdong2103 Lol...sure, whatever makes you feel good about yourself!
I know this is an older video of yours, but I do like this format and I find it very educational! Thank you for your content.
I normally don't comment, but I have to say just stumbling onto your channel and this video changed the very tone of my night. I went from wanting to relax and be unproductive to wanting to hack away more on a Linux terminal in the late hours and discover more hidden gems. Seriously this is great content I'm sharing with all my coworkers and programmer friends alike.
Thanks for the kind words, glad I was able to provide some inspiration :)
That disown command is exactly what I needed for a script and could not find the solution anywhere else! Great Work!
Currently using 0/9 but will use one or two of them in the future. Great format please do more.
tobortine same here
and here...
Same here.
I do alot of linux. I am certified in linix and even these commands escaped me.
The one that will be most likely used the most would be sudo !!
Alternative to number 5:
^abc^abd
this repeats the last command, replacing abc by abd
gem
I remember finding out about this substitute command. Absolute game changer. from `less somefile.txt` `^less^vim` Now I use it all the time.
I`ve seen a lot of SSH tunneling tutorials and you, in no time, clearify a lot of stuff in no time. Kudos for that.
I guess he did it in no time!
8:11 I'd recommend a terminal multiplexer such as gnu screen or tmux for such use-cases. Not only will it continue running all your processes when you detatch (or the connection fails), but when you come back, you will see everything the same way as you left it (if you didn't restart the machine). Moreover, it allows you to have multiple screens and multiple sessions in only one window. It's an incredibly useful tool especially for ssh connections.
I wanted to give the same comment. Tmux is very useful.
If you aren't root but need to store stuff in RAM, you can create files in /dev/shm
Been using linux from terminals for 25 years and most were new to me. Awesome!
I have been using Linux for about 5 years and I know most of them, what have you been using Linux for? :)
@@sysstemlord
There was no RUclips or even web sites when I started to show you tips.
🤷
Definitely getting a crontab going on my buddy's computer to create 10000 folders every second
and disown that command with an added sleep so the chaos begins an hour after you leave the laptop
You could use awk and create the folders plus put a locked file in each one. :)
A crontab that runs every second? How does that work?
@@DaVince21
*/1 * * * * ( /get/fucked/noob.sh)
*/1 * * * * ( sleep 1 ; /get/fucked/noob.sh)
*/1 * * * * ( sleep 2 ; /get/fucked/noob.sh)
*/1 * * * * ( sleep 3 ; /get/fucked/noob.sh)
*/1 * * * * ( sleep 59 ; /get/fucked/noob.sh)
sure you'd be executing 60 jobs every minute, but hey it's not your pc :)
After seeing all these comments
Satan: Just wanna say, huge fan.
2:50 This is controlled by the HISTCONTROL variable in Bash. You have options to ignore commands with leading blanks, ignore duplicates, and even erase duplicates before inserting a new entry. There is also HISTIGNORE for more fine-grained control of which commands go into the history list.
It might be worthwhile to mention that you can control the editor program to use for ctnl+x+e or fc with exporting the environmental variable EDITOR, e.g.: export EDITOR=nano
bro how it works for arch?
@@patrickFREE.
The same thing why?
And this is. Bash variable you may used zsh in arch
I was looking for this comment. I got an error saying, "emacs: command not found", and assumed there was a default editor set. (I'm a vi user).
$ EDITOR=vim
did the trick.
Great video. Hands-down helpful with no stupid click-bait title! Love that. I also love that there are dozens of other helpful commands in the comments!
Short, straight to the point, useful. Brilliant!
This is about the best video *ever* on the premise "Commands you probably aren't using" - totally taking notes and will be invoking these, most DEFINITELY!
Got to admit, most of these commands I didn't know about and I've been using Linux for over 20 years! Subscribed! Can't wait for the next RUclips installment
Thanks for this. The use case for "disown" reminded me of another useful command that is the "screen" command, which allows us to have multiple sessions using the same terminal. We can get in a session, start some code, get out and things will run in background; and later, we can resume the session.
sudo bang bang
Bang батя в здании
HOLD FAST he shot me down, sudo bang bang - my terminal shot me - down. 😂
Bad system call
I was Linux, he a -nix
We root systems made of X
He wore Spark, and I wore ARM
He would always win the stack
Bang bang
I shut him down
Bang bang
He bit the Grub
Bang bang
Systemd shut us down
sudo gang bang. Oops I made a typo
Dude that’s great, I’m an old man restarting on Linux world and loads to learn, bg, exit from terminal and leave running I’ve tried the rest just saw it briefly. Tks dude and the format is really good, doesn’t cover the screen and ur presence doesn’t cause any inconvenience at all. Congrats man 👏🏼👏🏼👏🏼
Screen instead of disown for unreliable connections :)
better even, tmux
when you know before that you'll be gone until it finishes - yes. But normally you don't work *always* in screen and friends - then disown is perfect when boss wants unscheduled meeting right now and you need your laptop in the meeting room, i.e. disconnect - but that build is running, having spawned subprocesses ....
@@armynyus9123 unreliable connections, not unreliable bosses :)
@@farazsaidan you can upgrade to byobu
I use tmux on commonly used systems, but there have been times where I touch systems I don't own/maintain and I think this command could be useful (just found out about it).
Well, these are not commands but are useful tips:
1) Ctrl+t, if you need to swap last two typed letters, i.e. "daet"->"date"
2) To correct a mistyped executed last command without rewriting, i.e. you typed
"daet" and pressed enter. You can fix it this way: ^et^te, press enter
and see the results (obviously this suits better with long commands).
In short: ^(wrong)^(right)
Just for clarity, one more example: You executed "sotr". You fix it executing ^tr^rt.
love this format. also, i didn’t know about hitting space before a command or about fc. awesome.
I'm absolutely loving your unobtrusive PnP with no frame. I've only used one of these commands on a regular basis. Thanks for the tutorial.
here's a command many people probably don't use:
man bash
lol
@@james_gemma Is that a command to make a man bash something?
feminist flavor of *nix
@@MrFace Feminist only use SystemVag or SystemV for short. Others use SystemDick or SystemD
man mount... If you're into that sort of thing 😁
1st time viewer! Nice video! I've used 5of9 of the commands. Those fc and disown are new to me and are pure gold! Thanks for that. If anyone is interested: More info on those two commands can be found with $help fc or $help disown where $ is means the prompt.
Reverse a file, handy for last/lastcomm: tac (cat in reverse)
I have used 2 of these regularly (#3 and #8) when creating automation build scripts. I was always trying to speed up portions of the build and would try to farm out disk-intensive tasks to virtual RAM disks whenever possible. Being able to partition output from different parts of the build to different logs would not have been possible without the tee command. I plan to try to use more of these techniques.
Like he says at the start... you can be using linux for 25 years and still learn something. 1, 2, 5, and the bonus trick were totally new for me.
exact same for me
I’ve been using Linux professionally for a long time and never knew about Ctrl+x+e and fc. the rest I use pretty often, so thanks for helping out
You do not need to create a ramdisk under linux, just use /dev/shm directly. Fully POSIX compliant, you will not know the difference from a regular Ext4 FS.
In essence mount -t tmpfs tmpfs works pretty much like mount -o bind :)
you lost me. does the folder /dev/shm automatically run on ram or something?
@@MichaelMantion Yes. SHM stands for SHared Memory. www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html
THO! Unlike on that page, i don't think you need to mount it specifically, i cannot recall ever doing that.
@@MichaelMantion Checked, Ubuntu based distros auto mount it by default, but i recall years ago using on Debian we didn't even mount it and it was available as it is a device. Might be that the mounting thing is more of convenience type of thing (easy clearing and assurance to end user)
@@skaltura kernel configurable. You're eating your system semiconductor ram to use it, so if you're on a low memory system compared to useage needs - you might consider a disk based option ...
This is true for linux, but what abut Solaris, or HP(s)UX (do hey still exist) or any of the other unixen out there? Do the embedded unixen all have /dev/shm? It's worth understanding what's going on. Besides I believe the /dev/shm is often just the result of an fstab entry, so it's really just the same thing as what the presenter said.
Great video. To the point and super informative. I'll probably use at least half of these moving forward. The only one I knew was the creation of folders using the curly braces...
Please do more! And thank you!
Woah this was super useful.... thanks a lot.... need a part 2 of this
#1) This is simply your shell's built-in history substitution function, and it's always among the first things I disable ("set +H" in bash), because it makes typing anything with "!" in it an incredible PITA. You have to backslash-escape the ! _every time it appears_ (it ignores quoting), or else it will simply shove the previous command right inside your current one.
It's not really any harder just to up-arrow to the last command and hotkey jump to the start of the line. It's also easy to use +r,+s> history search for older commands (made even easier with the fzf plugin). That's just my personal preference, however.
See the HISTORY CONTROL section of the bash manpage for details on manipulating your history.
#2) In bash, this is the emacs-style keybinding. With vi-mode enabled (set -o vi), the key is 'esc+v' (esc to get into normal mode, a-la vim). The shell will use the value of the $EDITOR environment variable as the editor to use.
#4) In bash, this behavior is controlled by the HISTCONTROL variable. With the value "ignorespace" it acts as described in the video. I also add "erasedups" to mine, which makes it remove all older copies of the command, and only the newest one remains. "ignoredups", the last option for this variable, is basically the opposite of erasedupes; it will not add a command to history if it already exists, so that you keep the oldest entry.
You can also set globbing patterns in the HISTIGNORE variable, and it will not add anything that matches those patterns, good for commonly used commands like "ls" that you don't want cluttering up your history. See the "Shell Variables" section in the bash manpage for details.
#5) This is essentially the same as "up arrow + #2". fc is a shell builtin command for accessing and controlling your history list. Type "help fc" in bash or find its description in the manpage.
I also highly recommend setting the histreedit shell option, so that it puts your chosen history command back on the readline for editing, making you less likely to mistakenly re-run an old command (e.g. "rm -rf *") as-is.
Again, I also use vi-mode, which offers a lot of the same movement and editing commands as used in vim (jumping between words, etc), making it easy to do fairly complex editing on the command line (not that the default emacs-mode is any less capable, but I find the workflow and the hotkey bindings to be less intuitive).
#7) Brace expansion is very convenient, especially for creating numbered lists of things. I just want to caution that you should keep its usage separate from that of globbing ([^]*?) patterns. While globbing only _matches_ files or text strings that already exist, braces _generate_ (expand into) lists of strings before executing the command. e.g. "ls [fgh]oobar" will list out the files "foobar" and "hoobar" that exist in the directory, and ignore "goobar", which doesn't. On the other hand, "ls {f..h}oobar" will expand and execute the command "ls foobar goobar hoobar", resulting in a "no such file" error message on "goobar".
Note also that numbers can be zero-padded, and negative and descending range lists also work. They can also be combined and nested (e.g. "echo foo{{1..5},{a..e}}bar").
Finally, also be aware that brace expansion happens _before_ variable (and other parameter) expansions, so actions like "a=1 ;z=10; echo {$a..$z}" do not work as you would expect.
#8) That's a bit of a confusing explanation for tee. What tee does is fork its input into two parallel outputs, one channeled into a file, and one going to stdout. This allows you to monitor, duplicate, or redirect the output from the middle of a chain of commands without interrupting its operation. "info tee" will give you a detailed description.
#9) disown doesn't have to be used only when exiting. You can "remove" an unwanted process from the shell at any time. A common pattern is to "" to suspend a running foreground process, then "bg" to resume it as a background process, then "disown" to fork it away from the current terminal. Note that it's impossible to get it back again once disowned. You can only terminate it or send it other control signals (with the "kill" command or similar). Re the "JOB CONTROL" section of the bash manpage for details. Some people recommend the use of screen or similar multi-terminal applications for better background process management.
Video starts at 0:00
Thank me later
Video ends at 8:37
Fuck me later
Hahaha
HA
this is very helpful... i will thank you right away
Kai West don’t thank me but my video starts at 0:31 and the previous video ends at 0:00, leaving 0:30 for a commercial.
I didn't know ctrl+x+e or fc - nice
But then again - if running bash and tying 'set -o vi', you turn bash into vi mode, meaning ctrl+x+e is simply kv (or just v to access the editor from command mode). fc works well with vi too last I tried - I guess it just uses EDITOR or whatever's the default on your system. The rest was well known stuff.
Add "conv=fsync" to your dd command, which flushes pages to disk after dd has finished writing. Otherwise you're writing to pagecache (which is RAM anyway) and will get imprecise results.
Great video , just to add one minor details :
The ctrl+xe is a feature of the readline library used by the bash shell and so works only on bash shell. Other shells like zsh do have an edit-command-line wigdet but you need to configure in your .zsh .
# Enable Ctrl-x-e to edit command line
autoload -U edit-command-line
# Emacs style
zle -N edit-command-line
bindkey '^xe' edit-command-line
bindkey '^x^e' edit-command-line
# Vi style:
# zle -N edit-command-line
# bindkey -M vicmd v edit-command-line
You used bg. Why not include it in the list? I doubt there are many people that use that too.
yeah, This is the most useful command I learned by watching this video.
It it then necessary to share the rest of the useful commands:
- suspend the current process (I use this to suspend Vim to run tests in the same window): ctrl+z
- list processes: jobs
- foreground one of the options listed in jobs: %
- foreground the most recently suspended process: fg
EDIT: 12/23/18 - change background to suspend
you can also put a & at the end of the line to place the command in the background and not use ctrl Z ie sleep 120 &
@@wulymammoth You don't :put it in the background", you suspend it with Ctrl+Z. To put it in the background, that's what bg is for.
@@SeverityOne you're right! Gotta use bg for that. corrected :)
Amazing! That Folder command was mind blowing! I started to learn Linux a few week back and also am encouraging First year graduates to learn Linux too!! Will share this video later on with them!
You forgot to mention that the !! trick works with any command, not just sudo.
True 👏🏼👏🏼👏🏼
Does it just run the previous line with whatever is typed before !! ?
Also saves in bash history in expanded form so when you use the up arrow for recent commands it doesn’t say “Sudo !!” like you actually typed it it shows the whole effective command.
@@cartersherman925 !! just basically replaces itself with previous command. Example if you typed ls as first command, then you can do the following: sudo !! -al to do sudo ls -al
!-1 !-2
4:32 Couple more things worth clarifying about this command: 127.0.0.1 is the loopback address, so you can have services listening on this address without exposing themselves to the outside world. Also the “-N” option causes ssh to make the connection without doing anything else, like displaying a shell prompt. Instead of backgrounding it with CTRL/Z and then “bg”, you could have just stuck a “&” on the end of the command.
the space character to avoid history doesnt work on most of latest linux distrib. the command with the space is stored in the history aswell.
I agree. I tried it on Centos7 and it didn't work.
try HISTCONTROL="ignorespace" and then a command with a space
I tried it on Mint 19 without changing any settings and it works
there is a specific word that needs to be added to your .bashrc only then it would work ---- never by default.
@@KanishkkaKeshav I've found it - HISTCONTROL=ignoreboth. However, it was this way by default.
Been a linux user since 2012 and taught myself how ls -l works. Very useful and handy command. So glad to see that this is being spoken out and recommended by an engineer along side of other commands I never heard of.
Here’s another one: “mmv” to do bulk renames of files, e.g.
mmv «old-pre»\*«old-post» «new-pre»\#1«new-post»
will rename all files with names beginning with «old-pre» and ending with «old-post» so they begin with «new-pre» and end with «new-post», keeping the part in the middle the same.
This command can be quite dangerous if you get it wrong. So if you try it first with “mmv -n”, it will tell you what it would do without doing it. Then when you are sure you’ve got the patterns right, change the “-n” to “-v”, and it will go ahead and do it, and report what it has done as it goes.
Loved the video format! I learned a lot about issues I have been having and clearly didn’t know the solution to them. Thanks. Keep up the good work!
This video is life changing
2:36 tip 4: make sure you have the environment variable HISTCONTROL set to "ignorespace" or "ignoreboth" for this to work.
export HISTCONTROL=ignoreboth
5:03 tip 7: I think this requires the shell option extglob to be set, but maybe newer versions of baah (bash>=5.x) don't require this now. I double checked the man page and it didn't specify, so might not be required, but extglob is another really cool feature of bash!
shopt -s extglob
For people using real editors (vim), if you need to write a file with sudo:
:w !sudo tee %
Cool, that's a good one, thanks!
Jesus thank you.
Ah, Vim :-). Attempting to understand your example: User finds ':w' won't work. Permission denied. Instead pipe all the editor's content into 'sudo tee %' (the '!' executes a shell command). That will overwrite the currently open file since '%' in that command line context will be replaced by the current file name. At least this feels sensible.
People who use _real_ editors tend to be _real_ arrogant jackasses.
@@kevinbillingsley8256 , vim has a certain learning curve. Once a certain point is passed it proves to become quite the swiss army knife and very versatile. Myself, I am using it for about 20 years now virtually every day at work, am happy, and sometimes enjoying the text-adventure that also is vim. Recommend vim to fellow nerds (e.g., people watching videos like this one). Just do not badger the non-IT people and you are socially fine. Btw. nothing against nano. IMHO any Linux fanboy ought to bring nano basics if only for the fact that it seems to replace vim as the default onboard command line editor. Meaning, a fresh Linux will probably already have nano available where vim still would need being installed.
You can also type Ctrl+X+E when you have a long command in terminal. It will also open the editor to edit the long command, like fc.
When new to the curly bracket stuff, debug by prefix it with "echo". Try:
echo mkdir -p folder/{sub1,sub2}/{sub3,sub4}
We need more of this commands, they’re extremely helpful to my task I’m doing. Thanks for the video
for history ignoring lines with whitespaces you need 'HISTCONTROL=ignoreboth' to be set
If you want to not show your ascii art in the history, vi :sh
Thanks for that! You shouldn't rely on the "leading space" method tho, if you want to guarantee commands don't make it into history you can always ' unset HISTFILE '
I knew none of these, but started using a couple of them after seeing this video, and they are very usefull in my work life.
Thanks
I learned so much, thanks for sharing!
Really awesome even after 1 year of posting this. Thanks alot.. subscribed and alert SET. wont miss you videos from now on
Yes! More amazing videos! Keep it up. :)
Been a Linux guy for 20 years, this is a good video that covers some good basic things. I would suggest covering basic output redirection, tmux, Ctrl+r bash command, lspci and package management hacks.
I thought ctrl + r is an emacs command? It's backwards i-searching
You already have /dev/shm mounted by default to store things and files in memory.
In Linux sure. On other unixen too? Anyhow, I'm also wary that I will fill up /dev/shm and forget, thus causing the machine to start to thrash. SSD are a better answer -- and not that expensive.
Awesome video, I will definitely use some of these commands. I am new to Linux but I'm loving the power I have.
Great video - nice fast speaking tempo. I knew only 3 and I gotta try the sudo !! Damn...
I add this alias to my bashrc
alias pls='sudo $(fc -ln -1)'
Then when I need to re-run a command as root I just need to ask nicely ;)
Yeah, Thats Korn Shell syntax, adapted by Bash. I Think the variable LINENO -eq the number of last command executed.
Usually these lists consist of 75 % stuff like "ls -l" and take 62 minutes to come to the point. All these commands I didn't know of and it was quick and to the point. Thanks.
I didn't know about "disown". I'd use "screen" for this purpose since it allows re-connecting to a running shell later.
I don't use "fc" since I have "set -o vi" set in my shell, so Esc, v does the same thing.
I've never had need to use a RAM disk (other than the initrd). What's your use case for RAM disks from the command line?
Thank you for this video. I think it's a good idea to find obscure & useful commands that get forgotten over time.
I use Byobu. Makes maintaining my servers a dream.
Ramdisks can be useful in some (but not very frequent) workflows. Example: ETL Extract Transform Load. Extract to Ramdisk, do whatever you must do, load from ramdisk. If the transformation part is long you'll start loving Ramdisks .
When I did some data manipulation for deep learning, I had to transform my data set into something more sensible to be used for training, did a small python script for it, but due to the amount of data, it took a few minutes to run, this could have helped me reduce the time by a lot.. I could also have reduced the complexity of the script but not without a few hours of work, so not worth it
screen is very useful. It is also what I would probably use to perform multiple tasks or time-consuming tasks on a remote machine.
Lawrence D’Oliveiro I don’t use it a lot since I don’t work that much with remote machines and I got I3... I know there are some other features that screen has but i3 doesn’t but I still prefer using i3 over screen for tiling terminals...
Thanks for this video.. Really didn't know about "sudo !!" so far.. I had already days where this command could have saved me time to go for 2-3 extra coffes :'D
Yeah the video format is awesome and I would love to see similar videos in the future!
Really appreciate your work!
For the last one with disown personally I use tmux or screen this way you can still re attach and have input output available for the command. Nice commands even though I use them all keep up the good work 👍
0:45 Arrow up, Home "sudo ". Same number of keystrokes.
1:10 Pretty useful.
1:23 SSDs have *pretty much* obviated the need for this.
3:32 How is this *better* than using the up arrow?
5:06 Also useful.
7:00 A competent OS should not need this. Older systems (like OpenVMS) have a rich batch job system for long-running processes.
Awesome format. I’m not new to terminal commands, but I’m now to the Linux distros. Im enjoying them. Good stuff
Edit: My comment doesn’t make sense. I’m now to Linux, but not new to using terminals.
Edit #2: editing for *1st Edit:* comment: *new* to Linux...
[YT Comment Linter v3.4] ERROR 23, Line #6: Too many colons.
[YT Comment Linter v3.4] WARN 12, Line #6: Too much gibberish.
Just edit the comment, dude!
Give it up : )
I like to use pushd/popd in addition to cd when manipulating directory trees (this might be long for clarity).
pushd creates a stack of directories that can be manipulated so any directory in the stack can become the cwd. The stack can be viewed by 'dirs'. I find this incredibly useful when having to move between several directories (context switching, switching between source code an log directories, 'one of those days' when everything is on fire and I don't want to remember what directory I was in before being pre-empted by the latest fire drill, etc).
Example:
directory structure:
~/foo/bar/src
~/foo/bar/log
~/foo/bar/baz
# Start at ~/foo/bar/src
cwd: ~/foo/bar/src
-------------------------------------------------------------------------------------
# Change cwd to ~/foo/bar/log
$ pushd ~/foo/bar/log
~/foo/bar/log ~/foo/bar/src
# Check directory stack
$ dirs -v
0 ~/foo/bar/log
1 ~/foo/bar/src
-------------------------------------------------------------------------------------
# Change cwd to ~/foo/bar/baz
$ pushd ../baz
~/foo/bar/baz ~/foo/bar/log ~/foo/bar/src
# Check directory stack
$ dirs -v
0 ~/foo/bar/baz
1 ~/foo/bar/log
2 ~/foo/bar/src
-------------------------------------------------------------------------------------
# Switch the top 2 values of the stack by issuing pushd without any values
$ pushd
~/foo/bar/log ~/foo/bar/baz ~/foo/bar/src
# Check directory stack
(cwd is now ~/foo/bar/log)
0 ~/foo/bar/log
1 ~/foo/bar/baz
2 ~/foo/bar/src
-------------------------------------------------------------------------------------
# The numbers on the left of the dirs output are index values for the stack so now we can
# change cwd and alter the stack by index.
$ pushd +2 # index 2 of the stack changes cwd to ~/foo/bar/src
~/foo/bar/src ~/foo/bar/log ~/foo/bar/baz
One downside of this is that you need to use pushd when you start. Sometimes you forget to, or don't know you'll need it. A different usefil trick is "cd -" - it goes to the last directory yuo were in. It can't be used to backtrack several steps, but it's good for switching between two locations quickly and frequently.
i'm a linux super linux noob so i'm hyped that i knew one or two of these already. sudo bang bang FTW
Thanks for sharing, the ones new to me were:
* Ctrl+x+e
* fc
* disown -- though I am using nohup explicitly when I want something to stay alive; or, even better, run it inside screen/tmux if I plan to come back later on
And here is one for you: instead of using ps aux | grep (which runs an extra costly regexp grep) simply to a ps -FC in case you know the command; it uses the built in command matching instead of spawning grep as a second process; and if you cannot live without grep, please use fgrep (fast grep) -- this does not care for regexp and only does string matching -- way faster ;-)
This is amazing I am so impressed by the power of Linux
Bruh. This is a great way to rep Linux! Well done. It’s full of obscure (to me) and useful (to a bunch of folks) commands, it’s funny, and it seems shorter than it is. Right on. Thanks for your work.
Also, you could show some Windows users and they’d think, “Hmm, that’s handy.”
[up arrow key] + [home key] and then you type “sudo”. EASY!
Thank you! So many commenters here need to learn how to use their keyboard first, apparently. It's also safer because you always know what you're running as root instead "what ever the last thing I said because there are no consequences to my commands." Might as well use "sudo -s".
You have to strike 7 keys, sudo!! Only 6 :-P
except my laptop doesn't have a dedicated home key so i have to do a FN home.. Easier to just do sudo !!.
@SaltyBrains Using Putty (Windows), when I CTRL+A I get ^A. When I try the home key, it capitalizes the previous character. This is using the bash shell in Fedora 27. sudo !! works without dealing with this crap and I'm not a fish -- I can remember the last command I just typed.
@SaltyBrains get on that tmux game and embrace ctrl+b
Wow!
I'm new to linux, but already fascinated.
This Video is gr8! Thanks alot!
2:39 Hackerman Intensifies
great format! used to be unix/linux pretender. loved it. best computing time of my life.
I always used nohup to keep processes from being killed. Good to know there’s another way.
That's one of the most informative videos I've seen. Straight to the point and perfect explanations for each. Good video format too!
sudo !! : I use
ctrl+x+e : I didn't know about, will probably use
ramdisk : I didn't know about, will may use if the situation arises, good to know about
no history : I use
fc : I didn't know about, will probably use
ssh -L : use regularly
bash curly brace sets : I use
tee : I remember it now that you show it. Will probably use.
disown : good bonus, saved the best (for me) for last
Cheers!
0:19 The main use I have for “sudo” is “sudo /bin/bash”. Then I can do any number of things as root. Or, I dedicate a terminal window/tab to root operations with “exec sudo /bin/bash”. Then when I hit CTRL/D to logout, there is no non-root shell to go back to, the terminal window/tab simply disappears.
Why not just use `su` or `sudo su`?
@@Chr0n0s38 “su” requires the root password. If root doesn’t actually have a password, that won’t work. And “sudo su” seems kind of pointless -- use either sudo or su, not both.
@@lawrencedoliveiro9104 `sudo su` is the recommended way to get root privelages on Ubuntu. It's probably safer than `sudo /bin/bash` to be honest.
@@Chr0n0s38 Why?
@@lawrencedoliveiro9104 I stand corrected, it appears to be safe however each method of obtaining root actually puts you in a different state. For example `sudo su -` and `sudo -i` both behave like a full root login. `sudo /bin/bash`, `sudo su`, and just `su` all call the root .bashrc, but nothing else.
askubuntu.com/questions/376199/sudo-su-vs-sudo-i-vs-sudo-bin-bash-when-does-it-matter-which-is-used
Currently using 8 of 9, disown is the new command I have to own. Thanks for this interesting post.
Thank you! I will be using at least 3 of these on a daily basis from now on. Some of them are extremely relevant to what I do. Thank you for sharing.
I know this is meant for Linux, but that "sudo !!" command also works on mac!
I didn't even know something like that existed!
The amount of times I've run commands, only to forget that they require root, is more than the grains of rice I've ate in my life.
Most, if not all of the commands will work on Mac OSX because it uses the same shells that you can run on Linux. It‘s bash by default.
!! is a bash operator. I believe bash is the default shell on macos.
@@deadinternet66 It is, it's just that I didn't find out about these commands before, and some commands require installing packages on macOS using brew, which is why things like this surprise me since I didn't need to install anything beforehand.
I've changed my default shell to zsh, no difference in commands whatsoever, I just like the sub string search functionality :)
@@handsomepixel5193 I also use zsh as my shell on both macos and linux. You should checkout oh-my-zsh if you're a zsh fan. github.com/robbyrussell/oh-my-zsh
@@deadinternet66 I've used oh-my-zsh before, but it was too much "zsh power" for me too handle.
The plugins were nice, but I wanted a simpler and faster setup, so I instead downloaded the individual plugins myself and auto-source them through my .zshrc
I use zsh-syntax-highlighting and zsh-async-git-prompt, and I consider that enough for now.
Right away using 3-4. This is a life saver for anyone who regularly builds from sources and/or doesn't necessarily use any ide
The "space trick" to exclude a command from history does not work in bash 4.4.19, at least on a Mac.
Balazs Rau there’s a bash variable called HISTIGNORE that has to be set properly for that trick to work.
Video was great. I didn't know like 6 of those and using Linux full time for 2 years and part time since like 2008. Good job.
1:20 lol I always try to hide my own nudes folder
maybe it was nodes, like server nodes :DD not nudes :DDD
Dude, im super excited for this video. I understood everything but have no practice using linux. Normally I get over explabored but you hit the mark with the pace and interesting content.
The two most helpful commands for me currently are:
1. cd -
2. ( )
cd - is one of my favorites.
followed closely by reverse search ctrl + r
@@seanshuping rm basename and rm dirname destroyed my distro... i want to replace with zenity xdg-open.
Wow. I’ve been using Linux since RedHat 4 and I can honestly say that I have only ever heard of two of those juicy tidbits. Thanks! All of them were extremely helpful and I’ll be incorporating them in my day to day now.
For the last one, I personally prefer tmux.
Yes, I too like tmux.
This is the quickest I've ever subbed to a channel. One video and done. Thank you, sir. These will be super helpful.
Welcome! Glad you enjoyed the video!
Why on earth are you piping into cat?
Damn furries everywhere
@@rosangelaserra4552 In hindsight, perhaps I should have phrased that differently. 🙂
Either it's an in-joke for the "useless use of cat" crowd, or maybe it's because it's just a demonstration you silly pedant. 🐱
The entire command is weird ... why would someone TEE a static file ? Either something other is going on, or it is a very bad example
@@monday6740 the static input seems like an example to me, guess examples are fine. Personally I find
| cat > /dev/null
much worse. 😱
I just loved the way how to use ramdisk for very fast file i/o.. This would definetly help me in future..thanks and make more awesome linux/python tutorials...all these small videos you make actually teaches me alot. Thank you again and excited for more videos... :)
Terminals best friend “Tab” 😉
Oh yeah, love tab when typing long file names or can’t remember how to spell something. Works at a CMD prompt on that other OS that should not be named. Lol. Slightly different though, sequences through all files that match. Use tab in vi on command line as well to fill out a file name.
@@johnwythe1409 right!? Oh and the other OS’s name is Linux’s challenged stepbrother 😂
@@Uneke I meant love it on Linux. Just happened to note what it does under the cmd prompt. I thought since this seems to be a Linux video, I thought I would make a joke vis a vie Voldemort/ Windows.
great stuff!
> sleep 123 &
is a little faster than sleep 123, suspending and then pushing the job to the bg ;)
Ctrl x+e
bash: emacs: command not found...
yum install emacs
This command has to be run under the root user..
sudo !!
win.
You may export the EDITOR environement variable to use any editor instead of emacs
echo 'export EDITOR=nano' > ~/.bashrc && source ~/.bashrc and then Ctrl x+e will launch nano
@@ericlecat6441 thanks bro
I am putting all off these on a list next to my screen, these are super useful! I also didn't know the bg command so now I have learnt 10 new useful commands!