Output the top 10 system user names and UID numbers of the current system to the screenhead/etc/passwdString interception1${variable name: Start position: Length}echo ${variable name: Start position: Length}Variable name =${variable name: Start
Enter UNAME-A in the command line mode, for example, when the interface shows i386 that the Linux system is version 32, download the corresponding JDK version on the official website, or load it directly onto my network disk
Sort by the second character of the 1th field, if the field is only 1 characters followed by a number, the order of the letters after the normal sort of 2 charactersRepeated lines in a uniq are repeated without repeating rows, such as:1122And the
The code below, implements some common monitoring variables of the Linux system, shares to everybody @. [Email protected]#=============================# #Filename=system_monitor.SH#Author: foxsir#date: .- Geneva- the#=============================##!/
# ubuntu terminal under command line Color configuration # parses out the branch name from. Git/head:find_git_branch () {local dir=. Headuntil ["$dir"-ef/]; Doif [-F "$dir/.git/head"]; Thenhead=$ ( usage: Append the above code to the ~/.BASHRC file,
Shell Process ControlUnlike Java, PHP and other languages, SH's process control is not empty, such as (the following is the PHP Process Control notation):phpif(isset($_get["Q"])){ search(q);} else{//Don't do anything } You can't write
Most UNIX system commands accept input from your terminal and send the resulting output back to?? to your terminal. commands usually read input from the standard input, which is the default terminal . Standard output, which is the terminal by
This script is not a complete script, has not implemented automatic mount partition, each disk is divided into 2, 1 partition for the 1g,2 partition of 2G.#!/bin/bashCount= ' fdisk-l|grep/dev/sd.*|grep-v '/dev/sda.* ' |wc-l 'I=1While [$i-le
The first part: expect explanationExpect allows us to automatically log on to remote machines, and can implement automatic remote execution of commands. Of course, if you use key authentication without a password, you can also implement automatic
#!/bin/bash #使用哪个shell执行echo "Hello World" username= "Tom" echo $username #chmod +x./test.sh settings can perform file #for loop output for skill in Ada coffe Action Java; Do echo "I am good at ${skill}script" Done#for file in ' ls/etc '; Do#echo
I wrote a script quit.sh, as follows:1 #/bin/bash2 If [$#-lt 1];then3 echo "must input at least one parameter!"4 Exit 15 fi67 if [= = "Q"];then8 echo "quit!"9 echo "$ (WhoAmI) quit @ $ (date)" >>/tmp/quit.txt #这里访问了quit. txtExit 0One elseecho "Wrong
1. Number of rows, words, and characters of the statistics file1) Number of lines:Wc-l fileCat File | Wc-l2) Number of wordsWc-w fileCat File | Wc-w3) Statistics of charactersWc-c fileCat File | Wc-c4) When not with any parameters, all three are
PS: Red is a variable in the following code and is changed according to its own environmentGet-mailbox-organizationalunit IT | New-moverequest-targetdatabase Jjr01 -baditemlimit 10000 #以OU为单位移动邮箱 get-mailbox-database jl01 |
* Represents 0 or more arbitrary characters? Represents only one arbitrary character# comment Symbols\ de-signifier symbol[[email protected] ~]# ls #1. txt #将后面内容注释 only run LS111 1.tar 3.txt Install.log yasuo.zip111.tar 1.txt anaconda-ks.cfg
first, to write a shell programExample 1:"program"1 #!/bin/sh2echo"Hello Word! "Run"description"The first line: #i/bin/sh means using an interpreter in the Ubuntu system to interpret the shell and run it/bin/sh. second line: echo "Hello Word!"
#命令输入特殊符号* is match 0 or more characters? is to match one character#是加上这行不生效\ is a de-righteous character$ is the prefix of the variable, using the variable; is used in the middle of two commands.[] is matching two filesls [12].txt = = ls 1.txt
After the CentOS restart, a lot of services need to start manually, it is troublesome, today will need to boot or shut down the service to organize a bit, put into the Linux shell, and then add the shell into the/etc/rc.local, you can realize the
1. Use the shell or Python to write a square (oldboy4.sh) to receive the number entered by the user.For example: with the + number implementation[Email protected]:~/script$ vim Oldboy_squarel.SH[email protected]:~/script$./oldboy_squarel.SHPlease
1, Reason analysis:No. Bash_profile This file can be displayed by configuring this file recovery path.2. Configuration steps:(1), Vim ~/.bash_profile Add the following command here:Export ps1= ' [\[email protected]\h \w]\$ '(2), after saving to
Bash variables are non-typed------------------------Unlike other programming languages, Bash does not differentiate between variables"type"In essence, bash variables are strings. But depending on the context, bash also allows comparison operations
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service