Linux sh 常用命令

linux sh 的语法

sh [-a] [-c] [-C] [-e] [-E] [-f] [-h] [-i] [-I][-k] [-m] [-n] [-p] [-r] [-s] [-t] [-T] [-u] [-v] [-x] [ argument ]



-a

Export all variables assigned to.



-c

Pass the string argument to the shell to be interpreted as input. Keep in mind that this option only accepts a single string as its argument, hence multi-word strings must be quoted.



-C

Don't overwrite existing files with ``>.''



-e

If not interactive, exit immediately if any untested command fails. The exit status of a command is considered to be explic- itly tested if the command is used to control an if, elif, while, or until; or if the command is the left hand operand of an ``&&'' or ``||'' operator.



-E

Enable the built-in emacs command line editor (disables -V if it has been set).



-f

Disable pathname expansion.



-h

Makes all commands use tracked aliases.



-i

Force the shell to behave interactively.



-I

Ignore EOF's from input when interactive.



-k

tells the shell to use Korn-compatible behavior in any case where the POSIX.2 behavior is different from the behavior specified by Korn. In particular, this affects the trap command.



-m

Turn on job control (set automatically when interactive).



-n

If not interactive, read commands but do not execute them. This is useful for checking the syntax of shell scripts.



-p

Turn on privileged mode. This mode is enabled on startup if either the effective user or group id is not equal to the real user or group id. Turning this mode off sets the effective user and group ids to the real user and group ids. Also on interactive shells and when enabled, this mode sources /etc/suid_profile (in- stead of ~/.profile) after /etc/profile and ignores the contents of the ENV variable.



-r

Invokes a restricted shell. In a restricted shell, you cannot do any of the following: use the cd command; change the values of the variables env, path or shell; use > or >> to redirect output; specify command names containing /. These restrictions do not apply during execution of profile files.



-s

Read commands from standard input (set automatically if no file arguments are present). This option has no effect when set after the shell has already started running (i.e. with set).



-t

Exits after reading and executing one command.



-T

When waiting for a child, execute traps immediately. If this option is not set, traps are executed after the child exits, as specified in IEEE Std1003.2 (``POSIX'') This nonstandard option is useful to put guarding shells around childs that block signals. The surrounding shell may kill the child or it may just re- turn control to the tty and leave the child alone.



-u

Write a message to standard error when attempting to expand a variable that is not set, and if the shell is not interactive, exit immediately.



-v

The shell writes its input to standard error as it is read. Useful for debugging.



-V

Enable the built-in vi command line editor (disables -E if it has been set).



-x

Write each command to standard error (preceded by a '+ ') before it is executed. Useful for debugging.

 

转载于:https://www.cnblogs.com/java-zone/articles/2876395.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
文件为压缩包,内包含doc、pdf版本任君选择。 本资源部分源自网络,如有纰漏还望告知。 整理不易,如果觉得不错,请点赞留言,谢谢!!! 本资源专为入门学习Linux的新手们量身定制。 内含Linux常用必会60+个命令实例以及详解。 Linux提供了大量的命令,利用它可以有效地完成大量的工作, 如磁盘操作、文件存取、目录操作、进程管理、文件权限设定等。 所以,在Linux系统上工作离不开使用系统提供的命令。 要想真正理解Linux系统,就必须从Linux命令学起, 通过基础的命令学习可以进一步理解Linux系统。 一、系统: # uname -a # 查看内核/操作系统/CPU信息 # head -n 1 /etc/issue # 查看操作系统版本 # cat /proc/cpuinfo # 查看CPU信息 # hostname # 查看计算机名 # lspci -tv # 列出所有PCI设备 # lsusb -tv # 列出所有USB设备 # lsmod # 列出加载的内核模块 # env # 查看环境变量 二、资源: # free -m # 查看内存使用量和交换区使用量 # df -h # 查看各分区使用情况 # du -sh # 查看指定目录的大小 # grep MemTotal /proc/meminfo # 查看内存总量 # grep MemFree /proc/meminfo # 查看空闲内存量 # uptime # 查看系统运行时间、用户数、负载 # cat /proc/loadavg # 查看系统负载 三、磁盘与分区: # mount | column -t # 查看挂接的分区状态 # fdisk -l # 查看所有分区 # swapon -s # 查看所有交换分区 # hdparm -i /dev/hda # 查看磁盘参数(仅适用于IDE设备) # dmesg | grep IDE # 查看启动时IDE设备检测状况 …………………………………………………………………………

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值