YouTip LogoYouTip

Linux Comm Set

Linux set Command

-- Learning is not just about technology, but also about dreams!

Linux Tutorial

Linux Tutorial Linux Introduction Linux Installation Linux Cloud Server Install Linux with WSL Linux System Boot Process Linux System Directory Structure Linux Forgot Password Solutions Linux Remote Login Linux File Basic Attributes Linux File and Directory Management Linux User and User Group Management Linux Disk Management Linux vi/vim Linux yum Command Linux apt Command

Shell Tutorial

Shell Tutorial Shell Variables Shell Passing Arguments Shell Arrays Shell Operators Shell echo Command Shell printf Command Shell test Command Shell Process Control Shell Functions Shell Input/Output Redirection Shell File Inclusion

Linux Reference Manual

Linux Command Complete Reference Nginx Installation and Configuration MySQL Installation and Configuration Linux Quiz

Shell File Inclusion

Nginx Installation and Configuration

Deep Exploration

Network Services

Computer Science

Web Service

Development Tools

Web Design and Development

Programming

Software

Scripting Languages

Programming Languages

Scripting

Linux set Command

Image 3: Linux Command Complete Reference Linux Command Complete Reference

The Linux set command is used to configure the shell.

The set instruction can configure the execution behavior of the shell being used, allowing settings to be made according to different requirements.

Syntax

set [+-abCdefhHklmnpPtuvx]

Parameter Description:

  • -a Mark modified variables for export to environment variables.
  • -b Make terminated background jobs immediately report their execution status.
  • -C Prevent output redirection from overwriting existing files.
  • -d The shell uses a hash table by default to remember used commands to speed up command execution. Use the -d parameter to disable this.
  • -e Exit the shell immediately if a command returns a non-zero value.
  • -f Disable the use of wildcard characters (globbing).
  • -h Automatically record the location of functions.
  • -H The shell can use "!" plus <command number> to execute commands recorded in history.
  • -k All parameters given to a command are treated as environment variables for that command.
  • -l Record the variable names used in for loops.
  • -m Use monitor mode.
  • -n Read commands but do not actually execute them.
  • -p Enable priority mode.
  • -P After enabling the -P parameter, when executing commands, actual files or directories are used instead of symbolic links.
  • -t Exit the shell after executing the following command.
  • -u Display an error message when an undefined variable is used during execution.
  • -v Display the input values as they are read by the shell.
  • -x Display the command and its parameters before executing each command.
  • +<parameter> Cancel a parameter that was previously enabled by set.

Examples

Display environment variables

# set
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=(="3" ="00" ="15" ="1" ="release" ="i386-redhat-linux-gnu")
BASH_VERSION='3.00.15(1)-release'
COLORS=/etc/DIR_COLORS.xterm
COLUMNS=99
DIRSTACK=()
EUID=0
GROUPS=()
G_BROKEN_FILENAMES=1
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/root
HOSTNAME=hnlinux
HOSTTYPE=i386
IFS=$' 
'
INPUTRC=/etc/inputrc
KDEDIR=/usr
LANG=zh_CN.GB2312
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=34
L
MAIL=/var/spool/mail/root
MAILCHECK=60
OLDPWD=/home/uptech
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/crosstools/gcc-3.4.6-glibc-2.3.6/bin
PIPESTATUS=(="2")
PPID=26005
PROMPT_COMMAND='echo -ne "

Image 4: Linux Command Complete Reference Linux Command Complete Reference

← Python File ReadPython File Read β†’