Linux-command not found问题

一、telnet命令

1.检查telnet是否有安装

#有输出说明已安装,如果没有输出则没有安装

rpm -qa telnet

#安装telnet

yum install -y telnet

#执行检查命令
[root@localhost ~]# rpm -qa telnet
[root@localhost ~]# 

#安装telnet
[root@localhost ~]# yum install -y telnet
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-66.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                         Arch                                            Version                                                  Repository                                        Size
=================================================================================================================================================================================================================
Installing:
 telnet                                          x86_64                                          1:0.17-66.el7                                            updates                                           64 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 64 k
Installed size: 113 k
Downloading packages:
warning: /var/cache/yum/x86_64/7/updates/packages/telnet-0.17-66.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY                                        ]  0.0 B/s |    0 B  --:--:-- ETA 
Public key for telnet-0.17-66.el7.x86_64.rpm is not installed
telnet-0.17-66.el7.x86_64.rpm                                                                                                                                                             |  64 kB  00:00:00     
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 Package    : centos-release-7-6.1810.2.el7.centos.x86_64 (@anaconda)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-0.17-66.el7.x86_64                                                                                                                                                                   1/1 
  Verifying  : 1:telnet-0.17-66.el7.x86_64                                                                                                                                                                   1/1 

Installed:
  telnet.x86_64 1:0.17-66.el7                                                                                                                                                                                    

Complete!
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 


#检查是否安装成功
[root@localhost ~]# rpm -qa telnet
telnet-0.17-66.el7.x86_64
[root@localhost ~]# 

2.检查telnet-server服务是否安装

#有输出说明已安装,如果没有输出则没有安装

rpm -qa telnet-server

#安装telnet

yum install -y telnet-server

#检查telcet-server是否安装

[root@localhost ~]# rpm -qa telnet-server
[root@localhost ~]# 
[root@localhost ~]# 

#安装telnet-server
[root@localhost ~]# yum install -y telnet-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package telnet-server.x86_64 1:0.17-66.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================================================================================================================
 Package                                              Arch                                          Version                                                 Repository                                      Size
=================================================================================================================================================================================================================
Installing:
 telnet-server                                        x86_64                                        1:0.17-66.el7                                           updates                                         41 k

Transaction Summary
=================================================================================================================================================================================================================
Install  1 Package

Total download size: 41 k
Installed size: 55 k
Downloading packages:
telnet-server-0.17-66.el7.x86_64.rpm                                                                                                                                                      |  41 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:telnet-server-0.17-66.el7.x86_64                                                                                                                                                            1/1 
  Verifying  : 1:telnet-server-0.17-66.el7.x86_64                                                                                                                                                            1/1 

Installed:
  telnet-server.x86_64 1:0.17-66.el7                                                                                                                                                                             

Complete!
[root@localhost ~]# 
[root@localhost ~]# 


#检查telnet是否安装
[root@localhost ~]# rpm -qa telnet-server
telnet-server-0.17-66.el7.x86_64
[root@localhost ~]# 

3.如果进行了telnet-server安装操作,且已成功安装,则由于telnet服务是由xinetd守护的,所以我们需要重新启动xinetd

service xinetd restart

[test@localhost ~]$ service xinetd restart
Redirecting to /bin/systemctl restart xinetd.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password: 



polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to restart xinetd.service: Access denied
See system logs and 'systemctl status xinetd.service' for details.
[test@localhost ~]$ 
[test@localhost ~]$ 
[test@localhost ~]$ 
[test@localhost ~]$

#如果执行报以上错误,则检查是否没有安装xinetd

rmp -qa xinetd

#安装xinetd

yum install -y xinetd

[root@localhost /]# rpm -qa xinetd
xinetd-2.3.15-14.el7.x86_64
[root@localhost /]# 

#重启xinetd
/bin/systemctl restart xinetd.service

[root@localhost /]# /bin/systemctl restart xinetd.service
[root@localhost /]# 

#xinetd启动成功,可以查看xinetd的运行情况
netstat -tnlp

4.可以ping通,但是telnet命令连接失败

[root@localhost ~]# ping 192.168.1.147
PING 192.168.1.147 (192.168.1.147) 56(84) bytes of data.
64 bytes from 192.168.1.147: icmp_seq=1 ttl=128 time=0.702 ms
64 bytes from 192.168.1.147: icmp_seq=2 ttl=128 time=1.50 ms
64 bytes from 192.168.1.147: icmp_seq=3 ttl=128 time=1.76 ms
^X64 bytes from 192.168.1.147: icmp_seq=4 ttl=128 time=1.80 ms
^C
--- 192.168.1.147 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3034ms
rtt min/avg/max/mdev = 0.702/1.442/1.804/0.443 ms
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# telnet 192.168.1.147 6379
Trying 192.168.1.147...
telnet: connect to address 192.168.1.147: Connection refused

可能存在情况:

1)物理网络链路不通:从A地点到B地点没有路可以走

2)防火墙没有开通相关网络:从A地点到B地点由路,但是有路障

3)目标主机没有启动:就没有B地点

我需要连接的是win系统的服务,

可以ping通,说明应该是防火墙有拦截

为指定端口设置规则:

打开win系统的防火墙设置

选择高级选项

选择入站规则,选中新建规则

选择端口、选择特定本地端口、输入端口号、选择允许连接、下一步保存

放开防火墙后,发现还是连接不上

通过查询资料发现,原来redis是开启了受保护模式

将redis.conf中的protected-mode设置为yes(保护模式),外网按理说无法访问
但是protected-mode它启用的条件有两个,第一是没有使用bind,第二是没有设置访问密码(默认没有密码),因此我们注释bind外面就访问不到了,
所以我们使用密码或者设置bind都会让保护模式失效,这样外网就能访问到。

127.0.0.1:6379>
127.0.0.1:6379>
127.0.0.1:6379> config get "protected-mode"
1) "protected-mode"
2) "yes"
127.0.0.1:6379> config set "protected-mode" no
OK
127.0.0.1:6379> config get "protected-mode"
1) "protected-mode"
2) "no"
127.0.0.1:6379>

5.切换用户

#当安装某些工具时,没有权限,需要切换用户

You need to be root to perform this command.

#需要root超级管理员权限才能执行特定命令,执行以下命令切换用户

su

此时需要输入密码

You need to be root to perform this command.
[test@localhost /]$ su
Password: 
[root@localhost /]#

二、Shell

1.在编写shell脚本时,为变量赋值,出现line 3: name: command not found

#注释
name = "test"
echo $name
unset name
echo $name

 解决:为变量赋值时,= 前后不能有空格

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 这个错误提示表明你当前的系统中没有安装 `arm-linux-gnueabi-gcc` 编译器。 如果你是在 Ubuntu 或者 Debian 系统中,可以通过以下命令安装: ``` sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabi ``` 如果你使用的是其他 Linux 发行版,你需要搜索该发行版的软件仓库来找到对应的安装命令。 如果你是在 Windows 系统中,则需要安装适用于 Windows 的 `arm-linux-gnueabi-gcc` 编译器。你可以在网络上搜索相关的编译器并进行安装。或者你可以使用类 Unix 环境的工具链,如 Cygwin 或 MinGW 来进行交叉编译。 ### 回答2: "arm-linux-gnueabi-gcc command not found" 这个错误是由于系统中没有找到 arm-linux-gnueabi-gcc 编译器导致的。 arm-linux-gnueabi-gcc 是一个特定的 ARM 架构交叉编译器,用于编译针对 ARM 架构的程序。如果你在 Linux 系统上遇到了这个错误,说明你的系统中没有安装相应的交叉编译器。 要解决这个问题,你可以通过以下两种方式之一来安装 arm-linux-gnueabi-gcc: 1. 从软件包管理器中安装:首先,打开终端并运行适用于你的 Linux 发行版的包管理器命令(如 apt-get,yum,dnf 等)。然后使用命令搜索 arm-linux-gnueabi-gcc,安装相应的软件包。例如,在 Ubuntu 上,你可以运行以下命令进行安装: ``` sudo apt-get update sudo apt-get install gcc-arm-linux-gnueabi ``` 2. 手动编译和安装:如果你无法通过包管理器安装 arm-linux-gnueabi-gcc,你可以尝试手动编译和安装。首先,下载 GNU 工具链中最新版本的 arm-linux-gnueabi-gcc。然后,解压下载的文件,并按照其中的说明进行编译和安装。 无论你选择的方法是哪一个,安装成功后,你应该能够在终端中通过输入 arm-linux-gnueabi-gcc 命令来验证安装是否成功。 ### 回答3: "arm-linux-gnueabi-gcc command not found"这个错误是由于您的系统上缺少了arm-linux-gnueabi-gcc编译器所引起的。 该编译器是用于交叉编译ARM架构的程序的。它将源代码编译成在ARM处理器上运行的可执行文件。 要解决这个问题,您可以按照以下步骤进行操作: 1. 确定您是否已经安装了arm-linux-gnueabi-gcc。您可以在终端中使用命令"which arm-linux-gnueabi-gcc"来检查是否已安装。如果未安装,可以进行下一步。 2. 打开终端并运行以下命令来安装arm-linux-gnueabi-gcc: sudo apt-get install gcc-arm-linux-gnueabi 3. 如果上一步中的命令无法找到软件包,您可能需要先更新软件包列表: sudo apt-get update 4. 在安装过程中,您可能需要提供管理员密码以确认安装。 5. 安装完成后,您可以再次运行"which arm-linux-gnueabi-gcc"来确认已安装成功。如果成功安装,则应该能够看到该编译器的路径。 如果您无法通过包管理器安装arm-linux-gnueabi-gcc,也可以尝试从官方网站下载适用于您的系统的安装包,并按照其提供的说明进行安装。 希望以上解答对您有帮助!

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值