Small count (Restricted shell)

If we need to restrict a Linux user to use only the commands we specify, we can use the restricted shell.Use in a normal command environment:Test: # bash-r # Enter the restricted shell# cd/bash:cd:restricted# exitSpecific settings:# useradd test     

Common Linux shell commands

1. File operationCP MV MkDir CatTouch creates a new file, changes the last modified dateSource makes the file effective immediatelyWc-l the number of rows in the filename statistic file2. System commandsWHO displays user information currently logged

SSH anti-brute shell script

Write an SSH anti-violence hack script.The principle is to detect the SSH connection log, filter the login failed IP, more than the number of login to add it into the Hosts.deny file, limit its login.The script is as follows:#! /bin/bashcat /var/log/

Shell scripts Delete backup file instances up to 30 days ago

According to company requirements, delete the server 30 days before the file, the following is the script:#vi del-30.sh#!/bin/bashlocation= "/mpgdata/"Find $location-type f-mtime +30-exec rm-f {} \;#chmod +x del-30.shDescription:/mpgdata/is the path

Special usage of $0,$?,$! in shell

Variable Description:$$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return value)$-Flag at a glance using the SET command$*All parameter lists. such as "$*" in the

Test usage of shell scripts

#!/bin/bash#1. Integer comparison operators#整数变量和整数常量比较Num1=15["$num 1"-eq] #测试num1是否等于15echo $? # #退出状态为0, means NUM1 equals 15["$num 1"-eq] #测试num1是否等于20echo $? # #退出状态为1, means num1 is not equal to 20["$num 1"-lt] # #测试num1是否小于15echo $? # #退出状态为1,

Base shell Script

#! /bin/shA= "Hello World"echo "A is"Echo $aecho ""echo "A is $a"Results of the output:A isHello WorldA is Hello World2 Getting the system time:Get today's period: ' Date +%y%m%d ' or ' date +%f ' or $ (date +%y%m%d)Get yesterday's period: ' Date-d

A few good shell scripts

A few examples of shell scripts, feel good." Example: 001 " judging the input as a number, character or other #!/bin/bashread-p ' Enter a number or string here: ' Inputcase $input in [0-9] ' echo-e ' good job, Your input is a numb eric! \ n ";

Getting Started with Shell learning

Impression, always think that as long as mastering the Linux command, natural for writing shell scripts will not be unfamiliar. This is not right. The first half of the sentence is true, it is necessary to master the Linux command, so as to write

Linux-shell Test

The nature of the test:is an action commandDetermine if the condition is true based on the $? return valueOperating Specifications:Format 1:test conditional expressionFormat 2: [Conditional expression]Contact method for the test operation:Direct

Judging usage in the shell

Test structure:The test command can be used to test the true and false of the expression condition, and returns0,false, which is not 0; format:Test expression    #expression是一个表达式, the expression can be compared by numbers, strings, text and file

Every time you read a specified directory, a specified number of file shell scripts

#!/bin/shpath=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbinlang=zh_cn. gb18030export path langanalyzer_home=$ (cd  "$ (dirname ") ";  pwd) cd  $ANALYZER _ Homedeclare -a filearrecho $1 ", " $2function listdirfile ()  {   #fileArr = ()

Command logging of shell script instances

input 1:[[email protected] --shiyan rec]#Catrecord1#!/bin/Bash#filename:record.SHdir=/tmp/Recread-P"Please input the session filename:"Filenamesesfile="$dir/$filename. Session"logfile="$dir/$filename. Timing.log"if[ -e $sesfile] Then Echo "$sesfile

Shell in && | | How to use

&& operators:Command1 && Command2&& the command on the Left (command 1) returns True (that is, returns 0, executed successfully) and the command (Command 2) on the right side of the,&& can be executed, in other words, "If this command succeeds &&

The shell of Linux learning notes

This article references: Shell Scripting Learning GuideThis article reads as follows: Know the shell directive, but do not know how to complete an automated shell script.Because when editing this article, the author is also a novice. So, in some

Shell theory Study (iii)

37. Adjust the properties of a variable Read-only variable: use the readonly commandReadOnly variable Name ReadOnly Other uses ReadOnly or readonly-p: Displays a list of variables that currently have read-only properties

Linux Learning Note Shell (ii)--Automation script

This article references: Shell Scripting Learning GuideThis article reads as follows: Know the shell directive, but do not know how to complete an automated shell script.Because when editing this article, the author is also a novice. So, in some

Linux Shell determines whether files and folders exist

The shell determines whether the file, directory exists, or has permissions#!/bin/sh mypath= "/var/log/httpd/" myfile= "/var/log/httpd/access.log" #这里的-x parameter Judging $ Whether the MyPath exists and has enforceable permissions if [!-X '

Java Project package runs in the shell

At work, there are times when you need to process some data, use Java to compare aspects, such as hbase, but you need to execute it in the shell, so the extra bag is harder to get into, and it's easy to package with Maven. First Pop.xml

Shell exits and returns a summary.

Shell exits and returns a summary. Common Responses in shell: exit, breakm, return Exit: In fact, after each command is executed, an execution state is returned! If the execution is successful, 0 is returned. If the execution limit is not

Total Pages: 541 1 .... 441 442 443 444 445 .... 541 Go to: GO

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.