已经找到“” 的记录453条
Linux swatch命令

Linux swatch命令

Linux 命令大全 Linux 命令大全

Linux swatch命令用于系统监控程序。

swatch可用来监控系统记录文件,并在发现特定的事件时,执行指定的动作。swatch所监控的事件以及对应事件的动作都存放在swatch的配置文件中。预设的配置文件为拥护根目录下的.swatchrc。然而在Red Hat Linux的预设用户根目录下并没有.swatchrc配置文件,您可将/usr/doc/swatch-2.2/config_files/swatchrc.personal文件复制到用户根目录下的.swatchrc,然后修改.swatchrc所要监控的事件及执行的动作。

语法

swatch [-A <分隔字符>][-c <设置文件>][-f <记录文件>][-I <分隔字符>][-P <分隔字符>][-r <时间>][-t <记录文件>]

参数说明

  • -A<分隔字符>  预设配置文件中,动作的分隔字符,预设为逗号。
  • -c<设置文件>  指定配置文件,而不使用预设的配置文件。
  • -f<记录文件>  检查指定的记录文件,检查完毕后不会继续监控该记录文件。
  • -I<分隔字符>  指定输入记录的分隔字符,预设为换行字符。
  • -P<分隔字符>  指定配置文件中,事件的分隔字符,预设为逗号。
  • -r<时间>  在指定的时间重新启动。
  • -t<记录文件>  检查指定的记录文件,并且会监控加入记录文件中的后继记录。

实例

开启系统监视

# swatch

Linux 命令大全 Linux 命令大全

Linux gitps命令

Linux gitps命令

Linux 命令大全 Linux 命令大全

Linux gitps命令用于报告程序状况。

gitps(gnu interactive tools process status)是用来报告并管理程序执行的指令,基本上它就是通过ps指令来报告,管理程序,也能通过gitps指令随时中断,删除不必要的程序。因为gitps指令会去执行ps指令,所以其参数和ps指令相当类似。

语法

gitps [acefgjlnrsSTuvwxX][p <程序识别码>][t <终端机编号>][U <帐号名称>]

参数说明

  • a  显示 现行终端机下的所有程序,包括其他用户的程序。
  • c  列出程序时,显示每个程序真正的指令名称,而不包含路径,参数或是常驻服务的标示.
  • e  列出程序时,显示每个程序所使用的环境变量。
  • f  用ASCII字符显示树状结构,表达程序间的相互关系。
  • g  显示现行终端机下的所有程序,包括群组领导者的程序。
  • j  采用工作控制的格式来显示程序状况。
  • l  采用纤细的格式来显示程序状况。
  • n  以数字来表示USER和WCHAN栏位。
  • p<程序识别码>  指定程序识别码,并列出该程序的状况。
  • r  只列出现行终端机正在执行中的程序。
  • s  采用程序信号的格式显示程序状况。
  • S  列出程序时,包括已中断的子程序信息。
  • t<终端机机标号>  指定终端机编号,并列出属于该终端机的程序的状况。
  • T  显示现行终端机下的所有程序。
  • u  以用户为主的格式来显示程序状况。
  • U<帐号名称>  列出属于该用户的程序的状况。
  • v  采用虚拟内存的格式显示程序状况。
  • w  采用宽阔的格式来显示程序状况。
  • x  显示所有程序,不以终端机来区分。
  • X  采用旧试的Linux i386登陆格式显示程序状况。

实例

显示指定用户信息

# gitps hnlinux

Linux 命令大全 Linux 命令大全

Linux sudo命令

Linux sudo命令

Linux 命令大全 Linux 命令大全

Linux sudo命令以系统管理者的身份执行指令,也就是说,经由 sudo 所执行的指令就好像是 root 亲自执行。

使用权限:在 /etc/sudoers 中有出现的使用者。

语法

sudo -V
sudo -h
sudo -l
sudo -v
sudo -k
sudo -s
sudo -H
sudo [ -b ] [ -p prompt ] [ -u username/#uid] -s
sudo command

参数说明

  • -V 显示版本编号
  • -h 会显示版本编号及指令的使用方式说明
  • -l 显示出自己(执行 sudo 的使用者)的权限
  • -v 因为 sudo 在第一次执行时或是在 N 分钟内没有执行(N 预设为五)会问密码,这个参数是重新做一次确认,如果超过 N 分钟,也会问密码
  • -k 将会强迫使用者在下一次执行 sudo 时问密码(不论有没有超过 N 分钟)
  • -b 将要执行的指令放在背景执行
  • -p prompt 可以更改问密码的提示语,其中 %u 会代换为使用者的帐号名称, %h 会显示主机名称
  • -u username/#uid 不加此参数,代表要以 root 的身份执行指令,而加了此参数,可以以 username 的身份执行指令(#uid 为该 username 的使用者号码)
  • -s 执行环境变数中的 SHELL 所指定的 shell ,或是 /etc/passwd 里所指定的 shell
  • -H 将环境变数中的 HOME (家目录)指定为要变更身份的使用者家目录(如不加 -u 参数就是系统管理者 root )
  • command 要以系统管理者身份(或以 -u 更改为其他人)执行的指令

实例

sudo命令使用

$ sudo ls
[sudo] password for hnlinux: 
hnlinux is not in the sudoers file. This incident will be reported.

指定用户执行命令

# sudo -u userb ls -l

显示sudo设置

$ sudo -L //显示sudo设置
Available options in a sudoers ``Defaults'' line:

syslog: Syslog facility if syslog is being used for logging
syslog_goodpri: Syslog priority to use when user authenticates successfully
syslog_badpri: Syslog priority to use when user authenticates unsuccessfully
long_otp_prompt: Put OTP prompt on its own line
ignore_dot: Ignore '.' in $PATH
mail_always: Always send mail when sudo is run
mail_badpass: Send mail if user authentication fails
mail_no_user: Send mail if the user is not in sudoers
mail_no_host: Send mail if the user is not in sudoers for this host
mail_no_perms: Send mail if the user is not allowed to run a command
tty_tickets: Use a separate timestamp for each user/tty combo
lecture: Lecture user the first time they run sudo
lecture_file: File containing the sudo lecture
authenticate: Require users to authenticate by default
root_sudo: Root may run sudo
log_host: Log the hostname in the (non-syslog) log file
log_year: Log the year in the (non-syslog) log file
shell_noargs: If sudo is invoked with no arguments, start a shell
set_home: Set $HOME to the target user when starting a shell with -s
always_set_home: Always set $HOME to the target user's home directory
path_info: Allow some information gathering to give useful error messages
fqdn: Require fully-qualified hostnames in the sudoers file
insults: Insult the user when they enter an incorrect password
requiretty: Only allow the user to run sudo if they have a tty
env_editor: Visudo will honor the EDITOR environment variable
rootpw: Prompt for root's password, not the users's
runaspw: Prompt for the runas_default user's password, not the users's
targetpw: Prompt for the target user's password, not the users's
use_loginclass: Apply defaults in the target user's login class if there is one
set_logname: Set the LOGNAME and USER environment variables
stay_setuid: Only set the effective uid to the target user, not the real uid
preserve_groups: Don't initialize the group vector to that of the target user
loglinelen: Length at which to wrap log file lines (0 for no wrap)
timestamp_timeout: Authentication timestamp timeout
passwd_timeout: Password prompt timeout
passwd_tries: Number of tries to enter a password
umask: Umask to use or 0777 to use user's
logfile: Path to log file
mailerpath: Path to mail program
mailerflags: Flags for mail program
mailto: Address to send mail to
mailfrom: Address to send mail from
mailsub: Subject line for mail messages
badpass_message: Incorrect password message
timestampdir: Path to authentication timestamp dir
timestampowner: Owner of the authentication timestamp dir
exempt_group: Users in this group are exempt from password and PATH requirements
passprompt: Default password prompt
passprompt_override: If set, passprompt will override system prompt in all cases.
runas_default: Default user to run commands as
secure_path: Value to override user's $PATH with
editor: Path to the editor for use by visudo
listpw: When to require a password for 'list' pseudocommand
verifypw: When to require a password for 'verify' pseudocommand
noexec: Preload the dummy exec functions contained in 'noexec_file'
noexec_file: File containing dummy exec functions
ignore_local_sudoers: If LDAP directory is up, do we ignore local sudoers file
closefrom: File descriptors >= %d will be closed before executing a command
closefrom_override: If set, users may override the value of `closefrom' with the -C option
setenv: Allow users to set arbitrary environment variables
env_reset: Reset the environment to a default set of variables
env_check: Environment variables to check for sanity
env_delete: Environment variables to remove
env_keep: Environment variables to preserve
role: SELinux role to use in the new security context
type: SELinux type to use in the new security context
askpass: Path to the askpass helper program
env_file: Path to the sudo-specific environment file
sudoers_locale: Locale to use while parsing sudoers
visiblepw: Allow sudo to prompt for a password even if it would be visisble
pwfeedback: Provide visual feedback at the password prompt when there is user input
fast_glob: Use faster globbing that is less accurate but does not access the filesystem
umask_override: The umask specified in sudoers will override the user's, even if it is more permissive

以root权限执行上一条命令

$ sudo !!

以特定用户身份进行编辑文本

$ sudo -u uggc vi ~www/index.html
//以 uggc 用户身份编辑  home 目录下www目录中的 index.html 文件

列出目前的权限

sudo -l

列出 sudo 的版本资讯

sudo -V

Linux 命令大全 Linux 命令大全

Linux rwho命令

Linux rwho命令

Linux 命令大全 Linux 命令大全

Linux rwho命令用于查看系统用户。

rwho指令的效果类似who指令,但它会显示局域网里所有主机的用户。主机必须提供rwhod常驻服务的功能,方可使用rwho指令。

语法

rwho [-a]

参数说明

  • -a  列出所有的用户,包括闲置时间超过1个小时以上的用户。

实例

显示本地局域网内的所有用户

# rwho
root   snail-hnlinux:pts/2 May 14 17:42

Linux 命令大全 Linux 命令大全

Linux shutdown 命令

Linux shutdown 命令

Linux 命令大全 Linux 命令大全

Linux shutdown 命令可以用来进行关机程序,并且在关机以前传送讯息给所有使用者正在执行的程序,shutdown 也可以用来重开机。

使用权限:系统管理者。

语法

shutdown [-t seconds] [-rkhncfF] time [message]

参数说明

  • -t seconds : 设定在几秒钟之后进行关机程序。
  • -k : 并不会真的关机,只是将警告讯息传送给所有使用者。
  • -r : 关机后重新开机。
  • -h : 关机后停机。
  • -n : 不采用正常程序来关机,用强迫的方式杀掉所有执行中的程序后自行关机。
  • -c : 取消目前已经进行中的关机动作。
  • -f : 关机时,不做 fsck 动作(检查 Linux 档系统)。
  • -F : 关机时,强迫进行 fsck 动作。
  • time : 设定关机的时间。
  • message : 传送给所有使用者的警告讯息。

实例

立即关机

# shutdown -h now

指定 10 分钟后关机

# shutdown -h 10

重新启动计算机

# shutdown -r now

Linux 命令大全 Linux 命令大全

Linux screen命令

Linux screen命令

Linux 命令大全 Linux 命令大全

Linux screen命令用于多重视窗管理程序。

screen为多重视窗管理程序。此处所谓的视窗,是指一个全屏幕的文字模式画面。通常只有在使用telnet登入主机或是使用老式的终端机时,才有可能用到screen程序。

语法

screen [-AmRvx -ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s <shell>][-S <作业名称>]

参数说明

  • -A  将所有的视窗都调整为目前终端机的大小。
  • -d<作业名称>  将指定的screen作业离线。
  • -h<行数>  指定视窗的缓冲区行数。
  • -m  即使目前已在作业中的screen作业,仍强制建立新的screen作业。
  • -r<作业名称>  恢复离线的screen作业。
  • -R  先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
  • -s<shell>  指定建立新视窗时,所要执行的shell。
  • -S<作业名称>  指定screen作业的名称。
  • -v  显示版本信息。
  • -x  恢复之前离线的screen作业。
  • -ls或--list  显示目前所有的screen作业。
  • -wipe  检查目前所有的screen作业,并删除已经无法使用的screen作业。

实例

创建 screen 终端

# screen //创建 screen 终端

创建 screen 终端 并执行任务

# screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令

离开 screen 终端

# screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令

#include 

main ()
{

}

"~/mail.c"       0,0-1    

在 screen 终端 下 按下 Ctrl+a d键

重新连接离开的 screen 终端

# screen -ls  //显示已创建的screen终端 
There are screens on:
2433.pts-3.linux    (2013年10月20日 16时48分59秒)    (Detached)
2428.pts-3.linux    (2013年10月20日 16时48分05秒)    (Detached)
2284.pts-3.linux    (2013年10月20日 16时14分55秒)    (Detached)
2276.pts-3.linux    (2013年10月20日 16时13分18秒)    (Detached)
4 Sockets in /var/run/screen/S-root.

# screen -r 2276 //连接 screen_id 为 2276 的 screen终端

Linux 命令大全 Linux 命令大全

Linux sliplogin命令

Linux sliplogin命令

Linux 命令大全 Linux 命令大全

Linux sliplogin命令用于将SLIP接口加入标准输入。

sliplogin可将SLIP接口加入标准输入,把一般终端机的连线变成SLIP连线。通常可用来建立SLIP服务器,让远端电脑以SLIP连线到服务器。sliplogin活去检查/etc/slip/slip.hosts文件中是否有相同的用户名称。通过检查后,sliplogin会调用执行shell script来设置IP地址,子网掩码等网络界面环境。此shell script通常是/etc/slip/slip.login。

语法

sliplogin [用户名称]

实例

改变用户的连接方式

# sliplogin kk // 改变用户的连接方式

Linux 命令大全 Linux 命令大全

Linux rsh命令

Linux rsh命令

Linux 命令大全 Linux 命令大全

Linux rsh命令用于远端登入的Shell。

rsh(remote shell)提供用户环境,也就是Shell,以便指令能够在指定的远端主机上执行。

语法

rsh [-dn][-l <用户名称>][主机名称或IP地址][执行指令]

参数说明

  • -d  使用Socket层级的排错功能。
  • -l<用户名称>  指定要登入远端主机的用户名称。
  • -n  把输入的指令号向代号为/dev/null的特殊外围设备。

实例

开启rsh服务

# chkconfig --list //检测rlogin服务是否开启

# chkconfig rsh on //开启rsh服务

# chkconfig -list //检测开启的服务

远程命令执行

# rsh -l hnlinux 192.168.1.88 /bin/ls //远程执行ls命令

Linux 命令大全 Linux 命令大全

Linux rlogin命令

Linux rlogin命令

Linux 命令大全 Linux 命令大全

Linux rlogin命令用于远端登入。

执行rlogin指令开启终端机阶段操作,并登入远端主机。

语法

rlogin [-8EL][-e <脱离字符>][-l <用户名称>][主机名称或IP地址]

必要参数

  • -E 忽略escape字符
  • -8 只识别8位字的字符
  • -L 允许rlogin会话运行在litout模式
  • -ec 设置escape字符为c
  • -c 断开连接前要求确认
  • -a 强制要求远程主机在发送完一个空的本地用户名之后请求一个密码
  • -f 向远端主机发送一个本地认证
  • -F 向远程主机发送一个可转寄的本地认证
  • -7 强制执行7为的传输
  • -d 打开用于远端主机通信的TCP套接口的调试
  • -k 要求包含远端主机的tisckets
  • -x 启动数据传输的DES加密
  • -4 只使用 kerkberos的版本4的认证

选择参数

  • -e<字符> 设置退出字符
  • -l<用户> 指定登陆的用户
  • -t<终端类型> 设置终端类型
  • 实例

    显示rlogin服务是否开启

    # chkconfig --list //检测rlogin服务是否开启
    

    开启rlogin服务

    # chkconfig rlogin on //开启rlogin服务
    

    登陆远程主机

    # rlogin 192.168.1.88
    Password:
    Password:
    Login incorrect
    Login:root
    Passwd:
    Login incorrect
    Login:kk
    Passwd:
    

    指定用户名登陆远程主机

    # rlogin 192.168.1.88 -l hnlinux
    
    Passord:
    Last login:Mon May 28 15:30:25 from 192.168.1.88
    
    # 
    

    Linux 命令大全 Linux 命令大全

    Linux reboot命令

    Linux reboot命令

    Linux 命令大全 Linux 命令大全

    Linux reboot命令用于用来重新启动计算机。

    若系统的 runlevel 为 0 或 6 ,则重新开机,否则以 shutdown 指令(加上 -r 参数)来取代

    语法

    reboot [-n] [-w] [-d] [-f] [-i]

    参数

    • -n : 在重开机前不做将记忆体资料写回硬盘的动作
    • -w : 并不会真的重开机,只是把记录写到 /var/log/wtmp 档案里
    • -d : 不把记录写到 /var/log/wtmp 档案里(-n 这个参数包含了 -d)
    • -f : 强迫重开机,不呼叫 shutdown 这个指令
    • -i : 在重开机之前先把所有网络相关的装置先停止

    实例

    重新启动

    # reboot
    

    Linux 命令大全 Linux 命令大全

    客户热线: