• Bash shell code to determine whether a file or folder exists


    Core code #Shell determines whether the folder exists #If the folder does not exist, create the folder if [ ! -d “/myfolder” ]; then mkdir /myfolder fi #Shell determines whether the file or directory exists or has permissions folder=”/var/www/” file=”/var/www/log” #- x parameter to determine whether $folder exists and has executable permission if [ ! […]

  • Example of line function of deleting “specified content” in Linux bash file


    The example of this paper describes the line function of deleting “specified content” in Linux bash file. To share with you for your reference, as follows: #!/bin/sh #Function: delete the line with “specified content” in the file #Operation mode:. / dline. Sh c.log = = > generate output file: c.log0 array=( “rm -f lvr_3531_pf_new” “arm-hisiv100-linux-gcc […]

  • Using shell to explain git commit & git tag & NPM publish & GH pages process of publishing open source tools


    Because of the complexity of the process and the old forgetting to change the version number (╯`) ╯ (╥━), the shell written to simplify the submission of open source tools by yourself is recorded. It’s written in alias.zshrcInside, directlycommand [version] [commit/tag message] [subtreeDir]Use,[version]and[message]Must. It includes automatic modification of version number, GIT submit operation, tag operation, […]

  • Some operations of Linux bash prompt (custom bash prompt)


    Some black technologies that allow you to customize bash prompts When you open a shell terminal in the Linux environment, you will see a bash prompt similar to the following in the command line: [[email protected]$host ~]$ Did you know that the command line prompt can actually add a lot of very useful information by itself? […]

  • Setting up proxy for brew / git / pip


    1. How to set up http / HTTPS proxy correctly When brew is set to pass Socks5 proxy, it will be found that PIP does not support Socks5 in fact. It can only pass http / HTTPS. Get port first Click on the status bar of the small rocket HTTP Proxy Preference Get the port […]

  • Ubuntu adds new users and gives root privileges


    1、 Switch to root sudo su 2、 Add a new user useradd frontng 3、 Set password for this user passwd frontng Prompt for password Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully 4、 Give root permission vim /etc/sudoers The revised documents are as follows: # User privilege specification root ALL=(ALL) ALL […]

  • Code auto deployment tool based on GitHub webhook


    Recently, the company has a project that needs to be deployed to the public network for testing. Due to frequent updates, it is too troublesome to manually update the server. Study it carefullygithubYesweb hook, develop a small tool for automatically obtaining code Logic analysis diagram Code get and some codes md5sum 41a4c2615848eebedb261c61fd0d3074 code-get 25d3637a6fd821f419486548c32666af code-get.exe […]

  • Summary of Linux operation and maintenance habits


    I have been engaged in operation and maintenance for one and a half years. I have encountered various problems, such as data loss, website mount, database file deletion by mistake, hacker attack, etc Today, I would like to sort it out and share it with you 1、 Online operation specification 1. Test use At the […]

  • Essential tips for getting started with Linux (e-Book)


    0 basic introduction Linux system operation and maintenance essential secret collection Many years ago, migrant workers taught themselves Linux system on the basis of 0. It was very hard along the way. Why write this e-book? It’s because the migrant workers encountered many difficulties and troubles when they were learning Linux, because there are too […]

  • Linux file management and Bash features


    File management commands on Linux Directory management command: mkdir:make directories mkdir [OPTION]… DIRECTORY… -P: automatically create the parent directory on demand;-V: verbose, showing the detailed process;-M mode: give permission directly;Note: the path base name is the action object of the command; the path before the base name must exist; rmdir:remove empty directories rmdir [OPTION]… DIRECTORY… […]

  • Linux command compact utility


    Explain This article lists the most basic linux commands that programmers need to know. Don’t step on them. Basic command CD switch working directory PWD the current working directory PWD – P shows the actual path instead of the link path LS – LHT lists files in the form of long lists, displaying sizes in […]

  • Find locate which is type


    which Which is used to find$PATHThe executable file is set in, but some files that are available after decompression are often not$PATHFor example, redis, mongodb, etc. #Find Java command location which java If not$PATHWe can also find it by looking up its process or port number, if you have access to it, like this #Find […]