here are a few I use
^string^replacement - changes first occurence of 'string' to 'replacement' e.g 'cat types' when you meant 'cat typos'
history | grep -i 'somecommand' - searches history for occurences of 'somecommand'
!236 - execute the 236th command in the history file
!236:p - in bash this echoes the the 236th command in the history file and makes it '!!'-able without executing it. in zsh it populates the prompt with this command
I also have the following in my bashrc, which converts each subfolder in the folder 'workspace' into a command and sets the version of node using nvm. (it can also be extended for python/ruby)
'for f in ls $HOME/workspace
do
alias $f="cd $HOME/workspace/$f;if [ -f .nvmrc ]; then nvm use --delete-prefix; fi"
done'
I find the git commands that I struggle with are the more advanced ones, such as merge and rebase. These commands can be difficult to understand and use correctly, so I often have to refer to documentation or online resources to make sure I'm using them correctly.
Regard: wildoftech.com/
use z instead of cd.
alias frequently used commands or long commands.
move to the latest alternatvies of commands . for example bat instead of cat.
also use shells like zsh (personal preference) that has plugin system and easy customizability
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
Ctrl + L -> Clear console (the same than typing `clear` and hitting enter.
Ctrl + C -> Cancel the current command (I see people closing the terminal and opening it again nowadays so, here it is 😆)
Arrow Up/Down -> Command history, you can browse through your command history to re-execute a command again or edit and then execute it.
It won't work in every single terminal but most Linux distros are configured the click of a middle mouse button as paste operation (clicking the mouse wheel).
When it messes up the port that you are using for development, like 1234 or 3000 as usual ones, and you get a "port already in use" complain, you can run
fuser 3000/tcp -k
to kill the process that 'hanged' this port. Being 3000 the given port and tcp or udp as protocol options. -k is just the "kill" optional.
When you have no permissions as a result of an npm install , yarn install or similar command, probably is because you forked the project as root, so you can simply change the owner (chown) of the project directory to your current user like that:
sudo chown -R $(id -u):$(id -g) ./
The ./ at the end means the current folder in context.
You can automate some jobs using bash in you daily work, for example:
wait 3 seconds (it's a fast process but you need it to complete before trying next step, otherwise you'll get an error as you can't exec things inside a non-raised container).
exec the container, with terminal context on it, cd into projects root dir.
launch the watch / serve / build command and show the output on the same terminal.
You can do the same but adapting it to your specific docker container specs.
Last but not least, the best advice I can provide is DON'T use the command line if you can avoid it.
I mean, we techies always try to automate things, using let's say a Git GUI like GitKraken will automate most of the job so you can focus yourself in things like... well things that you are paid for, that is developing. The same rule applies to any Gui, cli or automation that helps you avoid throwing commands in a terminal.
Meta-dev/para-dev (meaning things related to development) is nice as weekend project or self learning for fun but if you are paid by job or by time, don't waste your money (time) with that, you'll eventually copy paste commands that you don't fully understand and/or hit enter with a wrong command and mess it up, thus losing time and effort to make your environment to work properly again.
Latest comments (75)
here are a few I use
^string^replacement - changes first occurence of 'string' to 'replacement' e.g 'cat types' when you meant 'cat typos'
history | grep -i 'somecommand' - searches history for occurences of 'somecommand'
!236 - execute the 236th command in the history file
!236:p - in bash this echoes the the 236th command in the history file and makes it '!!'-able without executing it. in zsh it populates the prompt with this command
I also have the following in my bashrc, which converts each subfolder in the folder 'workspace' into a command and sets the version of node using nvm. (it can also be extended for python/ruby)
'for f in
ls $HOME/workspace
do
alias $f="cd $HOME/workspace/$f;if [ -f .nvmrc ]; then nvm use --delete-prefix; fi"
done'
I find the git commands that I struggle with are the more advanced ones, such as merge and rebase. These commands can be difficult to understand and use correctly, so I often have to refer to documentation or online resources to make sure I'm using them correctly.
Regard: wildoftech.com/
use
z
instead ofcd
.alias frequently used commands or long commands.
move to the latest alternatvies of commands . for example
bat
instead ofcat
.also use shells like zsh (personal preference) that has plugin system and easy customizability
It won't work in every single terminal but most Linux distros are configured the click of a middle mouse button as paste operation (clicking the mouse wheel).
When it messes up the port that you are using for development, like 1234 or 3000 as usual ones, and you get a "port already in use" complain, you can run
to kill the process that 'hanged' this port. Being 3000 the given port and tcp or udp as protocol options. -k is just the "kill" optional.
When you have no permissions as a result of an
npm install
,yarn install
or similar command, probably is because you forked the project as root, so you can simply change the owner (chown) of the project directory to your current user like that:You can automate some jobs using bash in you daily work, for example:
running this as bash will:
You can do the same but adapting it to your specific docker container specs.
Last but not least, the best advice I can provide is DON'T use the command line if you can avoid it.
I mean, we techies always try to automate things, using let's say a Git GUI like GitKraken will automate most of the job so you can focus yourself in things like... well things that you are paid for, that is developing. The same rule applies to any Gui, cli or automation that helps you avoid throwing commands in a terminal.
Meta-dev/para-dev (meaning things related to development) is nice as weekend project or self learning for fun but if you are paid by job or by time, don't waste your money (time) with that, you'll eventually copy paste commands that you don't fully understand and/or hit enter with a wrong command and mess it up, thus losing time and effort to make your environment to work properly again.
I like
<(some_command)
instead of a filename e.g. fordiff
to compare dynamic textsFor Bash:
CTRL
-x
-e
lets you edit complex command line constructs in the editor specified via$EDITOR
REF: jonasbn.github.io/til/bash/edit_co...
github.com/nvbn/thefuck
this is the best one I have.
Add parameter ‘—verbose’ to a lot of long lasting commands like ‘composers update’. Just to see something on the screen instead of a blinking cursor
vim with fzf + rg is a godsend
The fact that you can create functions to do anything in bash is just amazing:
here are some of my favourite aliases and functions
Pipe your input into awk and pull out something common.
Simplifying groups of commands
Combine this with other commands
alias g_p='type g_p ; git push origin
_getCurrentGitBranch
'