pbpaste|xmllint --format - | pbcopy
This is a follow-up article for CLI Intro. I have tried to capture a few commands that is being by me used as a developer. This might help someone to get started with CLI if they are facing these tasks and not using CLI so far.
The one-liners here extensively uses pbcopy
and pbpaste
. If you using *nix
you might be required to have some workaround to use the one-liners as is. I strongly suggest to have pbcopy
and pbpaste
, it lets you compose the one-liners with your normal activities through clipboards.
There might be few commands such as jq
that are not available out-of-the-box, if you get some error saying "Command not found", please take time to get it installed. I assure that the time you spend on these CLI will worth the efforts in long run.
pbpaste|xmllint --format - | pbcopy
pbpaste|jq . | pbcopy
pbpaste| base64 | pbcopy
pbpaste| base64 --decode| pbcopy
The below command was helpful when I had to copy a huge set of files from my hard-disk to the laptop. I was unable to do it in a single day, so I used the below command to have a resumable copy across multiple days.
rsync --progress -r ‘<source folder>’ ‘<destination folder>’
pwd|pbcopy
telnet <host> <port>
grep -r "<the content to find>" "<partent location from which the search happens recursively>"
grep -r "<the content to find>" --include "<comma separated list of file patterns. ex: '*.java, *js'>" "<partent location from which the search happens recursively>"
docker ps|awk '{print $1}' | tail -n +2 | xargs docker stop
pbpaste | sort | pbcopy
pbpaste | sort -u | pbcopy
Apart from the above commands, it will be good to get comfortable with commands like curl
, sed
, awk
and whatever you think might be needed for your tasks.
Leaving it to the reader to get the details of the commands.
Apart from that, it’s good to have a mindset that tries to spend some extra time for the first time and automate the mundane tasks. CLI accomplish that automation to certain extent.
For any feedback or corrections, please write in to: kannangce@rediffmail.com