As a software developer, I work daily many hours on the command line. This article summarizes some tools and tricks to speed up this work.
The basics
Bash, ZSH, Fish are Linux shells.
Oh-my-ZSH is a plugin for ZSH which is AWESOME!
Commands
Basics
cd: Change directory, e.g.cd ..,cd /home,cd foo/bar/bazpwd: Print the working directoryls: List the contents of the current directoryman: show manual / help pagehistory: Show the last commands executed in the shellrm filename.extremovesfilename.extmv filename.ext newname.jpg: Rename a file
Advanced
grep: Pattern searchcat filename: print the contents offilenameto the outputwatch: run any designated command at regular intervalsfree: Memory consumptiontopandhtop: display Linux processesfindandlocatetree: Print a directory treecloc: count lines of codewc: word count (or lines or characters)
Professional
tmux- terminal multiplexerdirenv
Internet
ping martin-thoma.com: Check if you can reach a domainssh 123.168.0.1: Connect to the IP123.168.0.1.screen: Create a new terminal session that can be detached / re-attachedifconfig- configure a network interface
Hardware Analysis
lsusb,lspci
Alias
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
The Bang
There are various commands with the "bang" !:
!!: Execute the last executed command in the bash history!*: Execute the command with all the arguments passed to the previous command!ˆ: Get the first argument of the last executed command in the bash history!$: Get the last argument of the last executed command in the bash history
The Dash
cd - jumps back to the directory in which you were before:
/home/moose$ cd foobar
/home/moose/foobar$ cd -
/home/moose$
git checkout - jumps back to the branch in which you were before.
.dotfiles git repository
Dotfiles a files which start with a .. Those files are hidden in Linux and
often contain configuration files. Here is mine.
Tools
ncdu: Find what is eating your disk space and delete it on the fly.httpie: Command line HTTP clientjq: JSON query toolranger: console file managertmux