Linux gitps命令用于报告程序状况。
gitps(gnu interactive tools process status)是用来报告并管理程序执行的指令,基本上它就是通过ps指令来报告,管理程序,也能通过gitps指令随时中断,删除不必要的程序。因为gitps指令会去执行ps指令,所以其参数和ps指令相当类似。
gitps [acefgjlnrsSTuvwxX][p <程序识别码>][t <终端机编号>][U <帐号名称>]
参数说明:
显示指定用户信息
# gitps hnlinux
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
参数说明:
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 rwho命令用于查看系统用户。
rwho指令的效果类似who指令,但它会显示局域网里所有主机的用户。主机必须提供rwhod常驻服务的功能,方可使用rwho指令。
rwho [-a]
参数说明:
显示本地局域网内的所有用户
# rwho root snail-hnlinux:pts/2 May 14 17:42
Linux shutdown 命令可以用来进行关机程序,并且在关机以前传送讯息给所有使用者正在执行的程序,shutdown 也可以用来重开机。
使用权限:系统管理者。
shutdown [-t seconds] [-rkhncfF] time [message]
参数说明:
立即关机
# shutdown -h now
指定 10 分钟后关机
# shutdown -h 10
重新启动计算机
# shutdown -r now
Linux screen命令用于多重视窗管理程序。
screen为多重视窗管理程序。此处所谓的视窗,是指一个全屏幕的文字模式画面。通常只有在使用telnet登入主机或是使用老式的终端机时,才有可能用到screen程序。
screen [-AmRvx -ls -wipe][-d <作业名称>][-h <行数>][-r <作业名称>][-s <shell>][-S <作业名称>]
参数说明:
创建 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 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 rsh命令用于远端登入的Shell。
rsh(remote shell)提供用户环境,也就是Shell,以便指令能够在指定的远端主机上执行。
rsh [-dn][-l <用户名称>][主机名称或IP地址][执行指令]
参数说明:
开启rsh服务
# chkconfig --list //检测rlogin服务是否开启 # chkconfig rsh on //开启rsh服务 # chkconfig -list //检测开启的服务
远程命令执行
# rsh -l hnlinux 192.168.1.88 /bin/ls //远程执行ls命令
Linux rlogin命令用于远端登入。
执行rlogin指令开启终端机阶段操作,并登入远端主机。
rlogin [-8EL][-e <脱离字符>][-l <用户名称>][主机名称或IP地址]
必要参数:
选择参数:
显示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 reboot命令用于用来重新启动计算机。
若系统的 runlevel 为 0 或 6 ,则重新开机,否则以 shutdown 指令(加上 -r 参数)来取代
reboot [-n] [-w] [-d] [-f] [-i]
参数:
重新启动
# reboot
Linux pstree(英文全称:display a tree of processes)) 命令将所有进程以树状图显示,树状图将会以 pid (如果有指定) 或是以 init 这个基本进程为根 (root),如果有指定使用者 id,则树状图会只显示该使用者所拥有的进程。
使用权限:所有使用者。
pstree [-a] [-c] [-h|-Hpid] [-l] [-n] [-p] [-u] [-G|-U] [pid|user]
或
pstree -V
参数说明:
显示进程的关系
pstree init-+-amd |-apmd |-atd |-httpd---10*[httpd] %pstree -p init(1)-+-amd(447) |-apmd(105) |-atd(339) %pstree -c init-+-amd |-apmd |-atd |-httpd-+-httpd | |-httpd | |-httpd | |-httpd ....
特别表明在运行的进程
# pstree -apnh //显示进程间的关系
同时显示用户名称
# pstree -u //显示用户名称