Last active
November 13, 2021 12:57
-
-
Save j0n3/ddeb8582e3363f9f2747097c79f4f72e to your computer and use it in GitHub Desktop.
Revisions
-
j0n3 revised this gist
Nov 13, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -228,8 +228,8 @@ try ```cd /tmp``` then ```cd -```. Will go to previous path. Do again to toggle # I have a browser, of course also you by installing ```lynx``` # youtube-dl you can download any youtube video. -
j0n3 revised this gist
May 15, 2017 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -180,9 +180,11 @@ example: # ToDo - Powerful find commands - for f in $(command); do command; done - redirect outputs (STDOUT STDERR...) # text to clipboard ```cat file.txt | xsel -i -b``` or ```xclip -sel clip < wiki_snt_testing.txt``` # Other great stuff ## who is on this network? -
j0n3 revised this gist
May 15, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -158,7 +158,7 @@ example: ```dosomething; notify-send``` ```dosomething && notify-send good || notify-send bad``` ```tail -f /tmp/kk.log | while read line; do notify-send "$line"; done``` ```ssh -t millocal 'tail -f /tmp/was.log' | while read line; do notify-send "$line"; done``` # help info man -
j0n3 revised this gist
May 15, 2017 . 1 changed file with 1 addition and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -86,11 +86,8 @@ use bash-completion package in order to help yourself completing available comma - sudo!! # command inception ``command $(command)``` # tools # escaping backslash is your friend\! -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -225,4 +225,12 @@ try ```cd /tmp``` then ```cd -```. Will go to previous path. Do again to toggle # diff files ```diff file1 file2``` ```vimdiff file1 file2``` # I have a browser, of course also you by installinx ```lynx``` # youtube-dl you can download any youtube video. (Also works for other common video/streaming platforms :wink: :wink:) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 18 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -208,4 +208,21 @@ example: ```expr $(expr 5 \\* 111) : "5\+"``` will count how many 'fives' the previous expr has # ping with datetime ```ping google.com -i 10| while read pong; do echo "$(date): $pong"; done``` will ping each 10 seconds and decorate ping output with date # never exit use ctrl + d instead as it will not keep the command on the history. Almost any console apps will quit (mysql, ssh sessions...) # go home ~ ```cd /home/use``` = ```cd $HOME``` = ```cd ~``` # toggle paths try ```cd /tmp``` then ```cd -```. Will go to previous path. Do again to toggle between paths. Zsh can handle more records ```cd -3```. Use completion to see what # diff files ```diff file1 file2``` ```vimdiff file1 file2``` -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living inside a terminal. I use debian + gnome3 + terminator + zsh + oh-my-zsh and some commands could not work on *all* terminals. # Bash shortcuts (from http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -130,7 +130,7 @@ Example: # finding packages apt search stuff ```dpkg-query --list``` or ```dpkg -l``` # environment variables - env @@ -184,6 +184,7 @@ example: - Powerful find commands - for f in $(command); do command; done - copy & paste - redirect outputs (STDOUT STDERR...) # Other great stuff @@ -205,3 +206,6 @@ example: ```expr 5 * 111``` will return 555 ```expr $(expr 5 \\* 111) : "5\+"``` will count how many 'fives' the previous expr has # ping with datetime ```ping google.com -i 10| while read pong; do echo "$(date): $pong"; done``` will ping each 10 seconds and decorate ping output with date -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -203,4 +203,5 @@ example: ## expr is calculator and much more ```expr 5 * 111``` will return 555 ```expr $(expr 5 \\* 111) : "5\+"``` will count how many 'fives' the previous expr has -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 11 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -187,9 +187,20 @@ example: # Other great stuff ## who is on this network? ```arp-scan -l``` ## info about my network card ```ethtool eth0``` useful info such as link speed ## my public ip ```wget -qO- ipecho.net/plain``` or easier with curl ```curl ipecho.net/plain``` ## weather in my city ```curl wttr.in/alcala_de_henares``` ## expr is calculator and much more ```expr 5 * 111``` will return 555 ```expr $(expr 5 \* 111) : "5\+"``` how many 'fives' does the previous expr have? -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 14 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -117,6 +117,9 @@ Example: ```tree -d -L 2``` # df -h # du --summarize -h | sort -h # uniq # ssh command ```ssh user@host -C -t 'sudo apt update && sudo apt dist upgrade -y'``` @@ -157,9 +160,20 @@ example: ```notify-send something``` ```dosomething; notify-send``` ```dosomething && notify-send good || notify-send bad``` ```tail -f /tmp/kk.log | while read line; do notify-send "$line"; done``` # help info man # Processes and jobs - my processes: ```ps ux``` - all processes ```ps aux``` - htop - go background: ctrl + z - list jobs: ```jobs``` - get job on foreground ```fg``` or ```%``` or ```%[jobnumber]``` or (zsh) ```%[command-name]``` # Different shells - sh vs bash vs zsh (+oh-my-zsh) - debug script (set -x) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,8 @@ This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living inside a terminal. I use debian + gnome3 + terminator + zsh + oh-my-zsh and some commands could not work on *any* terminal. # Bash shortcuts (from http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -138,13 +138,26 @@ dpkg-query --list - htop - ps aux - killall - locate/updatedb # vim ## execute current line in bash :.w !bash # notify require ```sudo apt install notification-daemon libnotify-bin``` (or only libnotify-bin) example: ```notify-send something``` ```dosomething; notify-send``` ```dosomething && notify-send good || notify-send bad``` # help info man # Different shells - sh vs bash vs zsh (+oh-my-zsh) - debug script (set -x) @@ -155,3 +168,12 @@ dpkg-query --list - Powerful find commands - for f in $(command); do command; done - copy & paste # Other great stuff ## my public ip ```wget -qO- ipecho.net/plain``` or easier with curl ```curl ipecho.net/plain``` ## weather in my city ```curl wttr.in/alcala_de_henares``` -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -83,7 +83,6 @@ use bash-completion package in order to help yourself completing available comma - ctrl + s: forward (only if ```setty -ixon```) - sudo!! # command inception ``command $(command)`` @@ -92,7 +91,7 @@ example: find ~/ -iname .sh # tools # escaping backslash is your friend\! # single dash Some apps cand handle - as input instead of a filename. @@ -154,4 +153,5 @@ dpkg-query --list # ToDo - Powerful find commands - for f in $(command); do command; done - copy & paste -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 11 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ Bash also has some handy features that use the ! (bang) to allow you to do some ## Bonus winner commands ctrl + 7 <- undo! (works for multiple records on history!!). Also ctrl + \_ (motion) ctrl + x ctrl + e: opens default editor for power command editing (executes after quit on bash or leave command on prompt on zsh) @@ -135,7 +135,16 @@ dpkg-query --list # More tools - sed - awk - grep + grep -v + grep -e - htop - ps aux - killall # vim ## execute current line in bash :.w !bash # Different shells - sh vs bash vs zsh (+oh-my-zsh) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,10 +57,9 @@ Bash also has some handy features that use the ! (bang) to allow you to do some ## Bonus winner commands ctrl + 7 <- undo! (works for multiple records on history!!). Also ctrl + \_. (motion) ctrl + x ctrl + e: opens default editor for power command editing (executes after quit on bash or leave command on prompt on zsh) (more on shortcuts: https://ss64.com/bash/syntax-keyboard.html) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Bash also has some handy features that use the ! (bang) to allow you to do some ctrl + 7 <- undo! (works for multiple records on history!!). Also ctrl + \_ (motion) ctrl + x ctrl + e: opens default editor for power command editing (executes after quit on bash or leave command on prompt on zsh) (more on shortcuts: https://ss64.com/bash/syntax-keyboard.html) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -58,7 +58,8 @@ Bash also has some handy features that use the ! (bang) to allow you to do some ## Bonus winner commands ctrl + 7 <- undo! (works for multiple records on history!!). Also ctrl + \_ (motion) ctrl + x ctrl + e: opens default editor for power command editing (executes after quit on bash or leave command on prompt on zsh) (more on shortcuts: https://ss64.com/bash/syntax-keyboard.html) -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 105 additions and 14 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,56 +1,147 @@ # living in a linux console This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living inside a terminal. # Bash shortcuts (from http://www.skorks.com/2009/09/bash-shortcuts-for-maximum-productivity/) ## Command Editing Shortcuts Ctrl + a – go to the start of the command line Ctrl + e – go to the end of the command line Ctrl + k – delete from cursor to the end of the command line Ctrl + u – delete from cursor to the start of the command line Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word) Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor Ctrl + xx – move between start of command line and current cursor position (and back again) Alt + b – move backward one word (or go to start of word the cursor is currently on) Alt + f – move forward one word (or go to end of word the cursor is currently on) Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word) Alt + c – capitalize to end of word starting at cursor (whole word if cursor is at the beginning of word) Alt + u – make uppercase from cursor to end of word Alt + l – make lowercase from cursor to end of word Alt + t – swap current word with previous Ctrl + f – move forward one character Ctrl + b – move backward one character Ctrl + d – delete character under the cursor Ctrl + h – delete character before the cursor Ctrl + t – swap character under cursor with the previous one ## Command Recall Shortcuts Ctrl + r – search the history backwards Ctrl + g – escape from history searching mode Ctrl + p – previous command in history (i.e. walk back through the command history) Ctrl + n – next command in history (i.e. walk forward through the command history) Alt + . – use the last word of the previous command ## Command Control Shortcuts Ctrl + l – clear the screen Ctrl + s – stops the output to the screen (for long running verbose command) Ctrl + q – allow output to the screen (if previously stopped using command above) Ctrl + c – terminate the command Ctrl + z – suspend/stop the command ## Bash Bang (!) Commands Bash also has some handy features that use the ! (bang) to allow you to do some funky stuff with bash commands. !! – run last command !blah – run the most recent command that starts with ‘blah’ (e.g. !ls) !blah:p – print out the command that !blah would run (also adds it as the latest command in the command history) !$ – the last word of the previous command (same as Alt + .) !$:p – print out the word that !$ would substitute !* – the previous command except for the last word (e.g. if you type ‘find some_file.txt /‘, then !* would give you ‘find some_file.txt‘) !*:p – print out what !* would substitute ## Bonus winner commands ctrl + 7 <- undo! (works for multiple records on history!!). Also ctrl + \_ (motion) ctrl + x ctrl + e: opens default editor for power command editing (executes after quit on bash or leave command on prompt on zsh) (more on shortcuts: https://ss64.com/bash/syntax-keyboard.html) # Completion use bash-completion package in order to help yourself completing available commands. Zsh and oh-my-zsh is a great combination as it let you navigate through options. ```apt install bash-completion``` # Viewing files - Less is more than more - cat - tail - head - ccze -A: colorize (great combo with tail) # history - ctrl + r: backward search - ctrl + s: forward (only if ```setty -ixon```) - sudo!! # copy & paste # command inception ``command $(command)`` example: find ~/ -iname .sh # tools # escaping # single dash Some apps cand handle - as input instead of a filename. Example: ```ls | vim -``` will open ls ouput as content for vi # double dash -- use two dashes to stop parsing parameters. Example: ```touch -- -hello``` ```rm -- -hello``` (remember those ugly filenames?) # tree ```tree -d -L 2``` # df -h # ssh command ```ssh user@host -C -t 'sudo apt update && sudo apt dist upgrade -y'``` # alias # which, whereis, whatis # finding packages apt search stuff dpkg-query --list # environment variables - env - set # More tools - sed - awk - grep # Different shells - sh vs bash vs zsh (+oh-my-zsh) - debug script (set -x) - do not beep, plz (setterm -blength 0) - Any executable #!/path/to/tool (such as #!/bin/bash #!/bin/php # ToDo - Powerful find commands - for f in $(command); do command; done -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 20 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,28 @@ This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living in a console # Bash shortcuts - Ctrl + a : go to the start of the command line - Ctrl + e : go to end - # Completion use bash-completion package in order to help yourself completing available commands ```apt install bash-completion``` # Viewing files - Less is more than more - # history - ctrl + r: backward search - ctrl + s: forward (only if ```setty -ixon```) # copy & paste # subcommands # tools -
j0n3 revised this gist
May 14, 2017 . 1 changed file with 21 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,24 +2,29 @@ This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living in a console # Completion # Viewing files # Managing History # copy & paste # subcommands # tools # escaping # strange filename use two dashes to stop parsing parameters. Example: ```touch -- -hello``` # tree # ccze -A # ssh command # alias # environment variables - env - set - # Tools - sed -
j0n3 created this gist
May 10, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ # living in a linux console This is a compilation of tips and tricks, tools and shortcuts for those who enjoy living in a console Topics: - Completion - Viewing files - Managing History - copy & paste - subcommands - tools - escaping - strange filename - tree - ccze -A - ssh command - alias - environment variables - env - set - # Tools - sed - awk - grep # Shells - sh vs bash vs zsh (+oh-my-zsh) - debug script (set -x) - do not beep, plz (setterm -blength 0)