资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

关于linux命令ti的信息

linux 执行sh文件,提示command not found

原因是linux 执行sh文件里面缺少PATH=$PATH:/sbin,添加进即可。

成都创新互联公司是一家集网站建设,鹿泉企业网站建设,鹿泉品牌网站建设,网站定制,鹿泉网站建设报价,网络营销,网络优化,鹿泉网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

1、首先需要打开电脑的桌面,如图所示,鼠标右键单击选择打开终端的选项。

2、然后就会进入页面,如图所示,在命令行输入 gedit /etc/profile,回车。

3、然后就会弹出对话框,如图所示,在下面的一行里面需要添加PATH=$PATH:/sbin。

4、最后,添加好之后,如图所示,点击左上角的保存即可完成操作解决问题了。

《Linux下部分常用指令笔记》

一、创建linux维护用户

登录root用户

创建新用户

useradd 新用户名

设置用户密码

passwd 新用户密码

二、安装jdk和配置环境变量

建议在root用户下直接安装jdk,并直接配置环境变量,同时给非root用户设置读和执行权限

解压包

tar xvf jdk包名.tar

配置全局变量

编辑/etc/profile文件

vi /etc/profile

按I键,切换成编辑模式。

在文件未加入一下配置

export JAVA_HOME=jdk的解压文件目录

export JRE_HOME=jdk的解压文件目录/jre

export CLASSPATH=.:${JAVA_HOME}/lib:${ JRE_HOME}/lib:$CLASSPATH

export JAVA_PATH=${JAVA_HOME}/bin:${ JRE_HOME}/bin

export PATH=$PATH:${JAVA_PATH}

保存并退出

Esc   

:wq

重载配置文件使其生效

source /etc/profile

检查是否安装成功

Javac

Java version

权限修改

读4写2执行1,顺序所有者、组成员、其他用户

Chomd  755  jdk的解压文件目录

三、安装tomcat

安装tomcat和放入war包使用非root的维护用户

如果使用root安装的话记得设置权限。( chomd -r 外层文件目录 )

su - 用户名

1、解压包

tar  xvf  tomcat包名.tar

2、将war包放入tomcat/webapps目录下

3、Tomcat启动服务和停止服务

查看进程

ps -ef | grep java

启动应用

Tomcat bin目录下.startup.sh

停止应用

建议使用

Kill -9 进程号

注:解压出应用文件后,注意配置信息的修改

四、IBM MQ部署 (7.5之后的版本)

(以下是使用9.0版本的正确部署命令)

一、 卸载旧版本IBM MQ (可选)

因为部署环境没有安装过mq,卸载这部分命令我没有亲自测试过

设置环境

以用户身份登录到组mqm,找到mq的安装位置 /opt/mqm

source ./setmqenv -s

查看队列管理器的状态

dspmq -o installation

停止与要卸载的安装关联的所有正在运行的队列管理器

endmqm SXRECV

停止与队列管理器关联的所有侦听器。

endmqlsr -m SXRECV

查看系统上当前安装的软件包(组件)

sudo rpm -qa | grep MQSeries

列出软件包并一次性卸载

sudo rpm -qa | grep MQSeries | xargs rpm -ev

再将对应的用户及安装目录给删除

rm -rf /opt/mqm

userdel -r mqm

检查MQ license

license文件在安装目录中 /opt/mqm/lib 可以找到

amqtcert.lic - is a trial license

amqbcert.lic - is a beta license

amqpcert.lic - is the production license

——————————————————————————————————————

二、安装新版本ibm mq

解压,解压文件都在MQServer中

tar –xzvf IBM_MQ_9.1.5_LINUX_X86-64.tar.gz

进入MQServer文件夹中:

cd MQServer/

运行MQ许可证程序

./mqlicense.sh

安装WebSphere MQ for Linux服务器(Runtime、SDK 和 Server 软件包):

rpm -U MQSeriesRuntime-9.1.5-0.x86_64.rpm

rpm -U MQSeriesSDK-9.1.5-0.x86_64.rpm

rpm -U MQSeriesServer-9.1.5-0.x86_64.rpm

安装WebSphere MQ for Linux客户机:

rpm -U MQSeriesClient-9.0.0-0.x86_64.rpm

安装WebSphere MQ样本程序:

rpm -U MQSeriesSamples-9.0.0-0.x86_64.rpm

创建组和用户

安装过程创建了一个名为mqm的用户和一个同样名为 mqm 的组。设置一个密码来解锁。

passwd mqm

——————————————————————————————————————

三、 配置

(这部分队列管理器、通道、队列等根据实际情况自行配置)

切换用户:

su mqm

创建队列管理器

使用crtmqm命令来创建一个名为 SXRECV

的队列管理器。我们把它作为缺省队列,并且将不在创建时指定死信队列。然后使用strmqm命令启动队列管理器。

crtmqm -q  SXRECV

strmqm  SXRECV

——————

如果执行crtmqm命令时提示

-bash-3.2$ crtmqm

-bash: crtmqm: command not found

find / -name crtmqm

则需要配置mqm用户的环境变量,编辑如下文件,并添加下面的内容,如下:

第一种方法:相对第二种较安全仅对mqm用户有效

方法一:

(1) -bash-3.2$ vi /var/mqm/.bash_profile --有可能会在文件夹下看不到这个文件,通过编辑即可看到

PATH=$PATH:/opt/mqm/samp/bin:/opt/mqm/bin:bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin

(2)执行“.”命令,使这个文件生效

-bash-3.2$ source  .bash_profile

(3)再次尝试实行crtmqm或是dspmqm命令,即可发现已经生效。

方法二:

( 1)

su  root

[if !supportLists](2)[endif]

vim /etc/profile

[if !supportLists](3)[endif] 在最后面加上:

PATH=$PATH:/opt/mqm/samp/bin:/opt/mqm/bin:bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/bin

( 4)关闭远程终端重新打开,无需重启服务器

——————

运行队列管理器

runmqsc SXRECV

创建通道和队列

DEFINE QLOCAL (XYDATA) REPLACE USAGE (NORMAL) DEFPSIST (YES) MAXDEPTH (300000) DESCR('兴业银行')

DEFINE QLOCAL (XYTRANS) REPLACE USAGE (XMITQ) DEFPSIST (YES) MAXDEPTH (300000) DESCR('兴业银行')

DEFINE QREMOTE (XYACK) REPLACE DEFPSIST (YES) RQMNAME (SXSEND)  RNAME (XYACK) XMITQ (XYTRANS) DESCR('XXXX')

DEFINE CHANNEL (XYDATA) CHLTYPE (RCVR) TRPTYPE (TCP) REPLACE DESCR('XXXX')

DEFINE CHANNEL (XYACK) CHLTYPE (SDR) CONNAME ('166.1.1.8(2214)') XMITQ (XYTRANS) TRPTYPE (TCP) DISCINT (0) CONVERT (NO) SHORTRTY (30) SHORTTMR (10) LONGRTY (999999999) LONGTMR (20) REPLACE DESCR('XXXX')

DEFINE CHANNEL (SVRCONN) CHLTYPE (SVRCONN) MCAUSER('mqm')

创建监听

DEFINE LISTENER (RECLISTENER) TRPTYPE (TCP) CONTROL(QMGR) PORT (2214)

启动监听

start LISTENER(RECLISTENER)

启动通道

start channel(SVRCONN)

start channel(XYDATA)

start channel(XYACK)

———————————————————————————————————————————————————

四、2035错误码 说明

如果程序连接mq报错2035,则需要对权限认证做设置,则进行以此操作

1、

ALTER QMGR CHLAUTH(DISABLED)

2、

ALTER CHL(通道名) CHLTYPE(SVRCONN) MCAUSER('mqm')

3、

ALTER AUTHINFO(SYSTEM.DEFAULT.AUTHINFO.IDPWOS) AUTHTYPE(IDPWOS) CHCKCLNT(OPTIONAL)

或者直接将连接认证选项置为空,将其完全关闭,指令如下:

ALTER QMGR CONNAUTH('')

在执行完上述两条命令中的任一条后,都需要刷新连接认证的缓存,指令如下:

REFRESH SECURITY TYPE(CONNAUTH)

五、mq操作命令

一、MQ的启动与停止

1、MQ的启动

strmqm QMgrName

如果启动默认队列管理器,strmqm后可以忽略队列管理器名称。

2、MQ的关闭

endmqm -i QMgrName

停止mq

二、MQ运行状态查看与常用操作

1、 查看队列管理器运行状态

su mqm

执行如下命令检查队列管理器运行状态:dspmq显示结果中QMNAME表示MQ队列管理器的名称,STATUS表示当前运行状态。运行状态有如下几种:Starting正在启动Running正在运行Ending正在停止Ended normally已经正常终止Ended immediately已经立即终止Ended preemtively已经强制终止Ended unexpectively异常终止

注意:停止MQ后必须使用dspmq命令进行状态检查

2、查看通道运行状态与启停通道

runmqsc

dis chl(*);查看所有通道定义

dis chs(*);查看所有通道状态,如果没有查询到通道状态,或报错AMQ8420: Channel Status not found,请启动通道

dis chs(ChannelName); 查看通道ChannelName的状态

通道状态有如下几种:

STARTING正在启动BINDING正在绑定INITIALIZING正在初始化RUNNING正常STOPPING 正在停止RETRYING重试PAUSED等待STOPPED已停止REQUESTING请求

start chl(ChannelName);启动通道

stop chl(ChannelName);停止通道

* 重置通道

reset channel(ChannelName); 重置通道序号。当本地与其他MQ队列管理器的通道无法正常启动的情况,检查日志发现是通道序号不一致,此时就需要先停止发送方通道,清空队列深度并在发送方和接收方进行通道计数的重置,重置后启动通道即可恢复通讯。

注意:重置成功mq序列号一般相同或相差1

3、查看通道监听状态与启停监听

runmqsc

dis listner(*);查看通道监听定义

dis lsstatu(listnerName);查看监听状态

start lstr(listnerName); 启动监听

stop lstr(listnerName); 停止监听 

4、查看队列深度

runmqsc

dis q(*);查看所有各类队列的属性

dis qlocal(QName);查看所有本地队列的属性

队列深度属性为:CURDEPTH

查看队列深度display ql('队列名')  curdepth

*清空队列深度

清空队列深度

clear ql(‘队列名’)

三、MQ发送和接收消息

su mqm

发送消息

amqsput  队列名  队列管理器

获取消息

amqsget  队列名  队列管理器

可通过配合查看队列深度命令,完成mq的联调

六、其他维护中常用linux命令

1、测试端口连接

telnet ip port

2、查看已启动的端口

netstat -an | grep 端口号

3、查看应用进程

ps -ef |grep java

4、修改权限

chomd  XXX(对应的权限)  文件目录

5、修改文件或目录下所有文件所有者和组

Chomd -R 用户名:组名  文件目录

6、查看目录内容

ls 或者ls -l (简写ll)

7、查看文件输出

cat 目录/文件名

或者

Vi 目录/文件名 按i可进入编辑

按 G 到文档末尾

按 gg 到文件首行

不保存退出

Esc   :q!

保存退出

Esc   :wq

vi 进入文档文档后查找关键字

Esc 进入命令行

/关键字

按n向下继续查找

按N向上继续查找

8、杀进程

Kill -9 进程号

9、复制

cp -r 源目录  目标目录

10、移动

mv  -i 源文件或目录 目标文件或目录

11、删除

rm -R 文件目录

12、 切换工作目录

cd  相对路径或绝对路径

~也表示为 home 目录 的意思, . 则是表示目前所在的目录, .. 则表示目前目录位置的上一层目录。

Linux操作系统下Sudo命令的使用方法

建议:

在Linux系统下,右键打开终端后,可以输入"man sudo"或者"info sudo"查询,因为使用方法实在是太多,可以摘要如下,其他可以自己查看。

NAME

sudo, sudoedit - execute a command as another user

SYNOPSIS

sudo -h | -K | -k | -L | -l | -V | -v

sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]

{-i | -s | command}

sudoedit [-S] [-p prompt] [-u username|#uid] file ...

OPTIONS

sudo accepts the following command line options:

-b The -b (background) option tells sudo to run the given command in

the background. Note that if you use the -b option you cannot use

shell job control to manipulate the process.

-E The -E (preserve environment) option will override the env_reset

option in sudoers(5)). It is only available when either the

matching command has the SETENV tag or the setenv option is set in

sudoers(5).

-e The -e (edit) option indicates that, instead of running a command,

the user wishes to edit one or more files. In lieu of a command,

the string "sudoedit" is used when consulting the sudoers file. If

the user is authorized by sudoers the following steps are taken:

1. Temporary copies are made of the files to be edited with the

owner set to the invoking user.

2. The editor specified by the VISUAL or EDITOR environment vari-

ables is run to edit the temporary files. If neither VISUAL

nor EDITOR are set, the program listed in the editor sudoers

variable is used.

3. If they have been modified, the temporary files are copied back

to their original location and the temporary versions are

removed.

If the specified file does not exist, it will be created. Note

that unlike most commands run by sudo, the editor is run with the

invoking user's environment unmodified. If, for some reason, sudo

is unable to update a file with its edited version, the user will

receive a warning and the edited copy will remain in a temporary

file.

-H The -H (HOME) option sets the HOME environment variable to the

homedir of the target user (root by default) as specified in

passwd(5). By default, sudo does not modify HOME (see set_home and

always_set_home in sudoers(5)).

-h The -h (help) option causes sudo to print a usage message and exit.

-i The -i (simulate initial login) option runs the shell specified in

the passwd(5) entry of the user that the command is being run as.

The command name argument given to the shell begins with a '-' to

tell the shell to run as a login shell. sudo attempts to change to

that user's home directory before running the shell. It also ini-

tializes the environment, leaving TERM unchanged, setting HOME,

SHELL, USER, LOGNAME, and PATH, and unsetting all other environment

variables. Note that because the shell to use is determined before

the sudoers file is parsed, a runas_default setting in sudoers will

specify the user to run the shell as but will not affect which

shell is actually run.

-K The -K (sure kill) option is like -k except that it removes the

user's timestamp entirely. Like -k, this option does not require a

password.

-k The -k (kill) option to sudo invalidates the user's timestamp by

setting the time on it to the Epoch. The next time sudo is run a

password will be required. This option does not require a password

and was added to allow a user to revoke sudo permissions from a

.logout file.

-L The -L (list defaults) option will list out the parameters that may

be set in a Defaults line along with a short description for each.

This option is useful in conjunction with grep(1).

-l The -l (list) option will list out the allowed (and forbidden) com-

mands for the invoking user on the current host.

-P The -P (preserve group vector) option causes sudo to preserve the

invoking user's group vector unaltered. By default, sudo will ini-

tialize the group vector to the list of groups the target user is

in. The real and effective group IDs, however, are still set to

match the target user.

-p The -p (prompt) option allows you to override the default password

prompt and use a custom one. The following percent ('%') escapes

are supported:

%H expanded to the local hostname including the domain name (on if

the machine's hostname is fully qualified or the fqdn sudoers

option is set)

%h expanded to the local hostname without the domain name

%p expanded to the user whose password is being asked for

(respects the rootpw, targetpw and runaspw flags in sudoers)

%U expanded to the login name of the user the command will be run

as (defaults to root)

%u expanded to the invoking user's login name

%% two consecutive % characters are collapsed into a single %

character

-S The -S (stdin) option causes sudo to read the password from the

standard input instead of the terminal device.

-s The -s (shell) option runs the shell specified by the SHELL envi-

ronment variable if it is set or the shell as specified in

passwd(5).

-u The -u (user) option causes sudo to run the specified command as a

user other than root. To specify a uid instead of a username, use

#uid. When running commands as a uid, many shells require that the

'#' be escaped with a backslash ('\'). Note that if the targetpw

Defaults option is set (see sudoers(5)) it is not possible to run

commands with a uid not listed in the password database.

-V The -V (version) option causes sudo to print the version number and

exit. If the invoking user is already root the -V option will

print out a list of the defaults sudo was compiled with as well as

the machine's local network addresses.

-v If given the -v (validate) option, sudo will update the user's

timestamp, prompting for the user's password if necessary. This

extends the sudo timeout for another 5 minutes (or whatever the

timeout is set to in sudoers) but does not run a command.

-- The -- flag indicates that sudo should stop processing command line

arguments. It is most useful in conjunction with the -s flag.

Environment variables to be set for the command may also be passed on

the command line in the form of VAR=value, e.g.

LD_LIBRARY_PATH=/usr/local/pkg/lib. Variables passed on the command

line are subject to the same restrictions as normal environment vari-

ables with one important exception. If the setenv option is set in

sudoers, the command to be run has the SETENV tag set or the command

matched is ALL, the user may set variables that would overwise be for-

bidden. See sudoers(5) for more information.

学习Linux能做什么???

linux命令是对Linux系统进行管理的命令。对于Linux系统来说,无论是中央处理器、内存、磁盘驱动器、键盘、鼠标,还是用户等都是文件,Linux系统管理的命令是它正常运行的核心,与之前的DOS命令类似。linux命令在系统中有两种类型:内置Shell命令和Linux命令。

模式切换

1、由图形到字符#logout或init 3。

2、由字符到图形界面init 5。

3、退出consolelogout或exit或ctrl+d。

4、注销Ctrl + Alt + Backspace。

5、关机#poweroff或init 0或shutdown -h now或halt -p。

6、重启#reboot或init 6或shutdown -r now。

关于linux中mount的命令

先不看 -o 及后面的参数,命令

mount -t nfs client:/partition /partition

将 主机 `client' 下的 /partition 目录 mount 到本机的 /partition 下,给个实例

mount -t nfs 192.168.100.1:/home/aaa /bbb

将 192.168.100.1 上的 /home/aaa 目录mount 到本地的 /bbb 目录。

mount -o 后面的则是用来指定文件系统的参数,对于你的情况,就是用来指定 NFS 系统的参数。你只要 man nfs 就可以看到这些参数的意义了,比如

timeo=n The time in deciseconds (tenths of a second) the NFS client waits for a response before it retries an NFS request.

即访问超时的定义,所以 timeo=14 就是设置超时为1.4秒

rsize=n The maximum number of bytes in each network READ request that the NFS client can receive when reading data from a

file on an NFS server.

即一次 READ 操作最大能读取的数据字节数,所以 rsize=8192 就是设置一次读取最大 8k字节。

wsize=n The maximum number of bytes per network WRITE request that the NFS client can send when writing data to a file on

an NFS server.

即一次 WRITE 操作最大能写的字节数。

intr 这个参数你可以不用理了,(根据 man nfs) 从 linux 2.6.25 以后,这个参数就没有意义了。

Linux操作系统下Sudo命令的使用方法?

名称:sudo

使用权限:在 /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 所执行的指令就好像是 root 亲自执行

参数:

-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 -l 列出目前的权限

sudo -V 列出 sudo 的版本资讯


标题名称:关于linux命令ti的信息
本文来源:http://cdkjz.cn/article/dsgdgge.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220