Curly Brackets in Linux Command Line
few use cases of curly brackets in linux terminal
Here are few use cases of curly brackets in linux terminal.
Selective deletion
If you have a directory that contains ten subdirectories and you want to delete three of them, the slow way to do it would be like this:
rm -rf /home/hudzilla/work
rm -rf /home/hudzilla/projects
rm -rf /home/hudzilla/sandboxBut that’s pretty darn slow and open to making mistakes - a much smarter way to is to let Bash perform multiple filename expansion by placing the options inside braces. For example, this would achieve the same as the three lines from above:
rm -rf /home/hudzilla/{work,projects,sandbox}creation of multiple folders from single command
If you want to create three subdirectory inside a directory, the slow way to do it would be like this:
mkdir /home/hudzilla/work
mkdir /home/hudzilla/projects
mkdir /home/hudzilla/sandboxSame could also be achieved by:
mkdir /home/hudzilla/{work,projects,sandbox}However having space after , will have unexpected effect:
It will create folders named: {work, projects,, sandbox}
Also you need to already have folder inside which you want to create sub-directories. In case of example mentioned here, there need to be folder named hudzilla.
Keep reading
How to solve Deployment Failure-`assets:precompile`
I was trying to deploy rails 6 app on ec2 server using capistrano when precompile failure lead to whole deploymentt failure. I had to uninstall cmdtest and install yarn
How to Sort an Array of Objects in JavaScript
How to Sort an Array of Objects in JavaScript
Ways to increase productivity while working from home
It could be quite challenging to work from home without serious commitment and right set of skills. Here are some effective tips that can help you.