In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what are the skills for using Bash". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the skills for using Bash?"
If you use your computer all day, it would be great if you could find commands that need to be repeated and write them down for easy use in the future. They all stay there, hiding in ~ /. Bashrc (or zsh users'~ /. Zshrc), waiting to improve your life!
When I execute a command that takes a long time to run, I often use a multitasking approach, and then I have to go back and check to see if the operation has been completed. However, with the useful say command, you don't have to do this anymore (this is on MacOS; please change it to equivalent according to your local environment):
Function looooooooong {START=$ (date +% s% N) $* EXIT_CODE=$?END=$ (date +% s% N) DIFF=$ (echo "$END-$START" | bc) RES=$ (python-c "diff = $DIFF; min = int (diff / 60); print ('% s min'% min") result= "$1 completed in $RES, exit code $EXIT_CODE." echo-e "\ n250 $result 2 > & 1 > / dev/null &}}
This command records the start and end time of the command, calculates the number of minutes required, and "says" the command invoked, the time spent, and the exit code. I find this super useful when a simple console ringtone is not available.
Install a little assistant
I've been using Ubuntu since I was a kid, and the first thing I need to learn is how to install software packages. One of the first aliases I have added is its assistant (named after the popular Terrier of the day):
Alias canhas= "sudo apt-get install-y"
GPG signature
Sometimes, when I have to sign an email GPG signature without a GPG extension or application, I jump to the command line and use the following annoying aliases:
Alias gibson= "gpg-encrypt-sign-armor" alias ungibson= "gpg-decrypt"
Docker
Docker has many subcommands, but Docker compose has more. I used to use these aliases to forget the rm flag, but now I no longer use these useful aliases:
Alias dc= "docker-compose" alias dcr= "docker-compose run-rm" alias dcb= "docker-compose run-rm-build"
Google Cloud's gcurl assistant
To me, Google Cloud is a relatively new thing, and it has a lot of documentation. Gcurl is an alias that ensures that when you connect to Google Cloud API with a local curl command with authentication headers, you get all the correct headers.
Git and ~ / .gitignore
I use Git a lot in my work, so I have a special section to introduce Git assistants.
One of my most useful assistants is the one I use to clone the GitHub repository. You don't have to run:
Git clone git@github.com:org/repo / Users/glasnt/git/org/repo
I set up a clone function:
Clone () {echo Cloning $1 to ~ / git/$1 cd ~ / git git clone git@github.com:$1 $1 cd $1}
Even though I always forget and giggle every time I see this in the ~ / .bashrc file, I also have a "refresh upstream" command:
Alias yoink= "git checkout master & & git fetch upstream master & & git merge upstream/master"
Another assistant to the Git family is to ignore files globally. In your git config-global-list, you should see a core.excludesfile. If not, create one and fill it with what you always put in each .gitignore file. As a Python developer on MacOS, for me, these are:
.DS _ Store # macOS cluttervenv/ # I never want to commit my virtualenv*.egg-info/* #... Nor any locally compiled packages__pycache__ #... Or source*.swp #... Nor any files open in vim so far, I believe you have a deeper understanding of "what are the skills for using Bash?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.