\u indicates that the current user name \h represents the machine name \w represents the base name of the current working directory \w represents the full path to the current working directory. $, $, $, $: $ The name of this shell file refers to the
View the default shell types supported in Linux:/etc/shellsEcho Output command-e support for character conversions with backslash controlControl character (requires quotation marks)
\\
Output \ Itself
\a
Shell script simulates Nginx service startup and shutdownNote: 3 slashes////is followed by a representation of the interpretation of the current statement, which must be removed in the actual script#!/bin/bash///defines which scripting language
The code is as follows:Download: Https://gitee.com/LoongWang/shellrecycling.git1#/usr/bin/EnvBash2 3 4 #定义5 #定义回收站目录6Recyclingdir='/usr/local/recycling/'7 #定义回收站log文件8recyclinglog='/var/log/recyclinglog'9
With the more and more application of Linux system in enterprise, the automatic management of server becomes more and more important, in some complex Linux maintenance work, a lot of repetitive output and interactive operation are not only time
Configuration knowledge such as Vim path is shown in table:
Related configuration Files
Function description
. viminfo
User's operation history using Vim
. VIMRC
Configuration file for
Shell script exercises 1. Script/root/bin/systeminfo.sh, which displays the current host system information, including hostname, IPV4 address, operating system version, kernel version, CPU model, memory size, hard disk size. #!/bin/bash
1. Shell: Command interpreter1) supported shells are saved in/etc/shells2) Default shell is/bin/bash2. Shell script writing:1) using the VI Editor2) One command per line, followed by3) Give executable permissions (x)3, the way of implementation:1)
Method 1: Use the wc-l commandWc-l can get the length of the current row, so the string for a single row can be obtained in this simple way, and the wc-l is the number of rows that get the current string content.The code is as follows: Echo "ABC"
By defaultShellis not timed out automatically, but it is sometimes necessary for it to automatically exit the terminal after a period of inactivity without an operation. 1. Create a file /etc/profile.d/autologout.sh :#
Because shell scripts are a collection of many commands, these commands may involve manipulating a file, and the execution of the shell script requires the current user to have permission to run the script, otherwise it will fail because of
To view the commands for the terminal tool:echo $TERMThe returned results are as follows:xterm-256color
To view the command for the shell environment:echo $SHELLThe returned results are as follows:/bin/bash
Switch the shell environment: chsh
8.10 Shell Special symbol Cut commandSpecial symbols (top):A 1.* represents 0 or more arbitrary characters.2. Represents only one arbitrary character ( whether it is a number or a letter, as long as it can be matched. )3.# This symbol in Linux
Shell IntroductionThe shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the command entered by the user and feeds it into the kernel to execute.There is a layer of things
Simple little script, big God DetourImplementation steps:1 Writing scripts2 Doing recurring planning tasks1 scripting[Email protected] ~]# vim tar.shScript content:#!/bin/bash#编写备份脚本, the file name contains a date label after the backup, preventing
This book focuses on the use of some of the Linux shell commands, explaining some of the shell's artifice.Chapter One small trial sledgehammerMainly introduces some basic shell instructionsTerminal printing: Echo, printfAliases: AliasTerminal
8.1:shell Introduction:The shell is a command interpreter that provides interaction between the user and the machine, supports specific syntax, supports logical judgments, loops, and each user can have his or her own shell:The CentOS default shell
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