1. 使用SSHSecureShellClient传文件的步骤是什么
SSH Secure Shell Client是SSH命令行控制终端,你应该是用SSH Secure File Transfer Client传输文件。
这里只谈论他的使用方法,关于SSH配置你再找其他文章。
一、登陆方法
你可以在登陆的SSH Secure Shell Client里单击工具栏里(或菜单)的New File Transfer Window,就直接登陆了。也可以单独运行SSH Secure File Transfer Client。
登陆非常简单,填写Host Name(你的服务器地址或域名),User Name(你的服务器用户名,注意你SSH使用root用户是否有权限登陆,或使用其他用户登陆),Port(你SSH登陆的端口,默认为23)。
二、传输文件
一般默认的SSH Secure File Transfer Client界面左边为你本地的磁盘信息,右边的为登陆后服务器的磁盘信息,确定需要传到服务器的文件,采用拖拽方法,也可以用鼠标右健upload上传。从服务器中下载文件到本地,你也可以用拖拽方法,或用鼠标右键Download下载。
三、注意事项
上传下载,你需要注意用什么方法上传下载,用二进制还是ASCII还是自动,有些时候我们需要指定一下,要不上传文件会有问题。
四、其他
SSH Secure File Transfer Client软件应该没有可选字符集utf8等,在有些linux里中文会出现乱码,你可以用filezilla的sftp,因为filezilla可以选择字符集,就不会有乱码了。你也可以用其他工具参与你的服务器配置。比如WinSCP,在改文件时特别有用,对于vi编辑器不太会用的是很好的替代工具。SecureCRT命令行控制终端可以选择字符集等等。每个工具都有不同的优缺点,结合起来你在维护服务器时才事倍功半。
2. ssh secure shell 如何使用
ssh端口是22 ssh是协议 是远程登录连接的协议 传输的数据加过密的
一般linux下用得多,一般linux vps都支持ssh登陆,window下可以用putty来连接ssh主机
host name 填写你要连接的远程主机IP
username 当然是连接远程主机的登录用户
port 端口默认端口号是22
连接即可
Putty 随着Linux在服务器端应用的普及,Linux系统管理越来越依赖于远程。在各种远
程登录工具中,Putty是 出色的工具之一。 Putty是一个免费的、Windows 32平台下的telnet、rlogin和ssh客户端,但是功能丝毫不逊色于商业的telnet类工具。 用它来远程管理Linux十分好用,其主要优点如下: ◆ 完全免费; ◆ 在Windows 9x/NT/2000下运行的都非常好; ◆ 全面支持ssh1和ssh2; ◆ 绿色软件,无需安装,下载后在桌面建个快捷方式即可使用; ◆ 体积很小,仅364KB (0.54 beta版本); ◆ 操作简单,所有的操作都在一个控制面板中实现。编辑本段操作指南
使用简介:
图1 Putty配置界面
把Putty下载到机器上,双击putty.exe,就出现如图1的配置界面。 选择“Session”,在“Host Name (or IP address)”输入框中输入欲访问的主机名或IP,比如server1或192.168.9.4。端口号(Port)根据使用的协议有所区别,ssh默认使用22,telnet默认使用23,rlogin默认使用513。 在“Protocol”单选栏中选择使用的协议,一般是telnet或ssh,这取决于服务器提供的服务。 在“Saved Session”输入栏中输入任务的名字,单击“Save”按钮,就可以把任务配置保存起来了。 配置完成后单击“Open”按钮,出现如图2的登录界面,就可以使用Putty连接Linux主机了。
图2 使用Putty登录界面
编辑本段常见问题
关于putty的一些使用中常见的问题 一、在Windows中使用putty登录FreeBsd系统时,能够输入用户名,但是输入密码后按回车键半天无反应 。 答:设置过程如下: 1. 在/etc/ssh/sshd_config中添加如下内容,使普通用户可以通过SSH登录: AllowUsers 普通用户帐号 UseDNS no 2. 将希望使用su命令的用户加入到wheel组中,在/etc/group中作如下修改 wheel:*:0:root,普通用户帐号 二、在login as: 后输入用户名,[email protected]'s password: 光标不动。即使输入正确的 密码也是没有反应? 答:这是因为putty不像telent那样会直接显示密码,而是不显示密码,只要你输入的密码是正确的, 即使不显示只要输完密码后直接回车即可进入,不用在乎光标不动。 当输入密码错误敲下回车时会出现 denice 以提示用户密码错误
3. iOS逆向工程(4)SSH免密码连接iPhone
先摘抄一段简单介绍:
安全外壳协议(SSH)是一种在不安全网络上提供安全远程登录及其它安全网络服务的协议。SecureShell,又可记为SSH,最初是UNIX系统上的一个程序,后来又迅速扩展到其他操作平台。
在我理解就是类似Windows 系统上面的Telnet,但是SSH相对于Telnet的一个重要优势就是所有传输都是经过加密的。
在iOS中我们使用OpenSSH软件。
OpenSSH原是一个在Linux下很实用的一个软件。iPhone本身就是一个运行BSD系统(可认为是一种Liunx)的硬件,因此,Cydia的作者Saurik把OpenSSH这一软件移植到了iOS平台上,并且简化了安全认证密钥的繁琐,使之成为一款可以在iPhone上运行的Cydia插件。
在iOS的系统管理中,多半是使用命令行。在远程管理中,多半是用OpenSSH通过Wi-Fi或者3G来对iPhone、iPad、iPod Touch执行命令修改文件等操作。
OpenSSH用途是在PC或者Mac上远程输入命令操作iOS设备,免去使用MobileTerminal,同时,也是一种在多系统下管理iPhone、iPad系统文件的方法。
连接到iPhone后可以执行各种UNIX命令,比如文件操作,拷贝删除,等等很多用途。
如果没有配置SSH免密码连接,那么我们在连接SSH的时候就会提示输入密码,每次都要输入很麻烦,比如:
1,如果本人是做iOS开发的,项目用到了GIT版本控制,一般都配置SSH密钥了。密钥已经存在了电脑的./ssh目录中,如果没有配置,那么可手动重新生成SSH密钥,比如:
ssh-keygen -t rsa -b 4096 -C "[email protected]"
2,生成完成后,我们会在./ssh目录中发现id_rsa.pub公钥这个文件。
然后我们把它出来放到个人目录下,并重命名,比如:
cp /Users/zhangdasen/.ssh/id_rsa.pub ~/authorized_keys
3,我们手动SSH进入设备中,或者通过PP助手进入设备中,查看是否存在var/root/.ssh目录,如果没有,我们手动创建下。可通过SSH连接后mkdir创建,或者PP助手连接后创建。
4,创建后我们把authorized_keys拷贝到设备中,可利用SCP命令:
scp ~/authorized_keys [email protected]:/var/root/.ssh
5,然后按正常我们就可以直接SSH连接的时候不用输入密码了,如图:
6,这个时候,如果我们使用tweak打包时候,也不会再让我们输入SSH密码了。
下一篇: iOS逆向工程(8) 一条命令砸壳(详细菜鸟版)
4. 怎样在SecureCRT的shell里用命令上传下载文件(转)
SecureCRT记住密码的功能容易设置,于是偶这懒人,后来习惯了用SecureCRT,但其上传文件功能偶一直没弄明白过。之前一直用的是pshell,因为pshell有个功能强大的secureftp功能,打开之后,直接将目录或文件拖到此窗口即可。SecureCRT却没有那么方便。 1.在shell里直接使用命令 首先最好设置好本地与远程主机传输文件的目录,因为使用命令下载文件时是不会提示选择下载的目标目录的。 设置方法:本地目录在 选项-》会话选项-》SFTP标签 的本地目录里设置。 目录设置好之后就可以使用命令上传和下载文件了 上传命令:rz rz输入后SecureCRT会打开一个文件选择对话框,供用户选择需上传的文件 下载命令:sz 可用sz -h 查看sz更多选项 用法很简单,但是可惜,使用这两命令不能传输目录,只能是文件。 2.使用SecureCRT的SFTP功能 在已连接的远程主机标签上点击右键选择连接SFTP标签页即可建立SFTP的连接,这是一个使用命令的连接会话不提供图形界面。 目录转换:远程主机上: 可以使用所有shell中的目录和文件操作命令:ls,pwd,cd等等来对 远程主机上的目录进行更改操作,不能使用vi等文件编辑工具 本地主机上:对本地目录进行操作需在以上命令前加上"l",即 ls-》lls,pwd-》lpwd,cd-》lcd文件传输上传文件: put file 上传目录:put -r dir 下载文件: get file 下载目录:get -r dir 注:这里file可以使用*等通配符 如果是通过通道机登录的某远程主机,则SFTP就不可用了。例如通过10.10.20.124登录的60.25.21.148,操作是在60.25.21.148上,直接右键建立SFTP连接是建立不起来的,因此只能使用上面的sz和rz的命令操作。
5. ssh secure shell 的命令是用什么语言的,我是新手,刚入门
ssh secure shell 只是一个网络工具,不是什么语言。
SSH(Secure Shell)是一种通用的、功能强大的、基于软件的网络安全解决方案。计算机每次向网络发送数据时,SSH都会自动对其进行加密。数据到达目的地时,SSH自动对加密数据进行解密。整个过程都是透明的,使用OpenSSH工具将会增进你的系统安全性。 谈到网络安全访问,相信大家首先想到的就是安全Shell,也就是Secure Shell,通常简写为SSH。这是因为SSH安装容易、使用简单,而且比较常见,一般的Unix系统、Linux系统、FreeBSD系统都附带有支持SSH的应用程序包。
6. ssh secure shell client怎么使用
1.通常情况下开发的web系统在apache + tomcat Linux环境中测试,使用客户端操作工具:SSH Secure Shell
首先是安装:SSHSecureShellClient-3.2.9.exe
安装完成后,打开Secure Shell Client -> Quick Connect
Host Name: 192.168.0.23
User Name: root
Port 22
Authentication <Profile Settings> 默认值
Connect -> Enter your Password -> OK
命令行界面定位到:[root@localhost root]#
同理打开:Secure File Transfer Client,用于文件传输。
2.目录结构(图形界面)
Xml代码
/
...
usr
apache2
...
conf
...
httpd.conf
bin
...
apachectl
tomcat5
...
conf
...
server.xml
bin
...
shutdown.sh
startup.sh
webapps
...
eWebEditor
3.命令界面
cd /usr/tomcat5/bin 转入到tomcat5 bin文件夹
./shutdown.sh 关闭tomcat服务
./startup.sh 启动tomcat服务
cd /usr/apache2/bin 转入到apache2 bin文件夹
./apachectl start|stop|restart|graceful 启动|关闭|重启|优化apache服务
ls 查看目录文件命令
move 文件夹 .. 移动文件夹到上一目录
rm -rf eWebEditor/ 删除文件夹eWebEditor
ps -ef|grep java 查看tomcat启动进程信息,进程ID
kill -9 进程ID 强制关闭tomcat服务进程
缓存清理
/usr/tomcat5/work/Catalina/eWebEditor 直接删掉eWebEditor文件夹清理缓存
4.配置文件
1./usr/tomcat5/conf 修改server.xml
增加一个Host节点 如下:
Xml代码
<Host name="eWebEditor.7234.com.cn"
debug="0"
appBase=""
unpackWARs="true"
autoDeploy="true">
<Context path=""
docBase="/usr/webapps/eWebEditor/"
debug="0"
privileged="true"
reloadable="true"/>
</Host>
2./usr/apache2/conf 修改httpd.conf
增加一个VirtualHost节点 如下:
Xml代码
<VirtualHost *>
<LocationMatch "/WEB-INF/">
AllowOverride None
deny from all
</LocationMatch>
<LocationMatch "/META-INF/">
AllowOverride None
deny from all
</LocationMatch>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
Rewriterule .* - [F]
ServerAdmin [email protected]
DocumentRoot /usr/webapps/eWebEditor/
ServerName eWebEditor.7234.com.cn
ErrorLog logs/eWebEditor.7234.com.cn-error_log
CustomLog "|/usr/local/sbin/cronolog /usr/logs/apache_logs/eWebEditor.7234.com.cn_access_log.%Y%m%d" combined
</VirtualHost>
5.本地hosts配置:C:\WINDOWS\system32\drivers\etc\hosts
192.168.0.23 eWebEditor.7234.com.cn
6.拼是否成功:开始->运行->cmd
ping eWebEditor.7234.com.cn
#查看域名对应的IP地址:是内网还是外网的方法或是否连接成功。
7.最后在浏览器中输入:http://ewebeditor.7234.com.cn/ 请求页面,查看页面显示效果。
备注:eWebEditor或eWebEditor.7234.com.cn或红色字体部分为变量,在实际使用过程中修改过来,本文以eWebEditor工程为例。
7. 华为交换机命令大全
aaa 解释AAA
acl 解释 Specify ACL configuration information
alarm解释 Enter the alarm view
anti-attack 解释 Specify anti-attack configurations
application-apperceive 解释 Set application-apperceive information
arp 解释 ARP mole
arp-miss 解释 Specify ARP MISS configuration information
arp-suppress 解释 Specify arp suppress configuration information, default is disabled
authentication 解释 Authentication
autoconfig 解释 AutoConfig configuration information
bfd 解释 Specify BFD(Bidirectional Forwarding Detection)configuration information
bgp 解释 Border Gateway Protocol(BGP)
bootrom 解释 BootRom
bp 解释 BPDU message
btv 解释 Btv view
bulk-file 解释 Specify the file name of bulk statistics
bulk-stat 解释 Set bulk statistics
capture-packet 解释 Capture-packet
ccc 解释 Circuit cross connection
cfm 解释 Connectivity fault management
clear 解释 Cancel current configuration
cluster 解释 Specify the information for cluster configuration
command-privilege 解释 Specify the command level
cp-car 解释 Cpu car setting
cpu-defend 解释 Configure CPU defend policy
cpu-defend-policy 解释 Configure CPU defend policy
cpu-usage 解释 Set cpu usage configuration
dhcp 解释 Dynamic host configure protocol
dhcp-snooping 解释 DHCP snooping
dhcpv6 解释 DHCPv6
diffserv 解释 Specify diffserv parameters
display 解释 Display priority information
dldp 解释 Device link detection protocol
dns 解释 Specify domain name system
domain 解释 Default domain
dot1x 解释 802.1x configuration information
drop 解释 Discard attribute
drop-profile 解释 Drop profile
dsa 解释 Specify DSA mole configurations
e-trunk 解释 E-Trunk
ecmp 解释 ECMP
efm 解释 EFM mole
erps 解释 Ethernet ring protection switching
error-down 解释 The interface was shut down because of an error event
event 解释 Enter the event view
execute 解释 Batch command
fib 解释 FIB status and configuration information
file 解释 Specify file system configuration information
ftp 解释 Set the FTP server attributes
garp 解释 Generic Attribute Registration Protocol
gtsm 解释 The generalized TTL security mechanism
gvrp 解释 Generic VLAN Registration Protocol
header 解释 Define the login banner
hwtacacs 解释
hwtacacs-server 解释
icmp 解释 Specify ICMP configuration information
icmp-reply 解释 Enable ICMP reply fast
igmp 解释 Specify IGMP configuration information
igmp-snooping 解释 Specify parameters for IGMP-Snooping
info-center 解释 Specify message output configuration information
interface 解释 Specify the interface configuration view
ip 解释 Specify IP configurations for the system
ipv4 解释 Configure ip packet
ipv6 解释 Enable IPv6 functionality
isis 解释 Intermediate System to Intermediate System (ISIS) routes
keychain 解释 Keychain authentication
l2-topology 解释 Layer 2 topology
l2protocol-tunnel 解释 Layer 2 protocol tunnel
lacp 解释 Link aggregation control protocol
lldp 解释 Link Layer Discovery Protocol
load-balance 解释 Specify load balance mode
loopback-detect 解释 Loopback detect function
lspv 解释 Lsp verification
mac-address 解释 Mac address
mac-authen 解释 MAC authenticate configure information
mac-forced-forwarding 解释 Mac-Forced Forwarding
mac-learning 解释 MAC learning
mac-spoofing-defend 解释 MAC spoofing defend
matched 解释 Is Command can be matched by upper template
mip解释 Configure a rule used to create MIP
mld-snooping 解释 Specify parameters for MLD-Snooping
monitor-link 解释 Monitor link configuration information
mpls 解释 Specify MPLS(Multiprotocol Label Switching) configuration information
mpls-qos 解释 MPLS QoS
msdp 解释 Specify MSDP(Multicast Source Discovery Protocol) configuration information
mtrace 解释 Trace route to multicast source
multicast 解释 Multicast information
nap 解释 NAP protocol
nd 解释 Neighbor discovery
ndp 解释 Neighbor discovery protocol
nqa 解释 Network Quality Analysis(NQA)
nqa-jitter 解释 Switch NQA jitter version
nqa-server 解释 Specify NQA echo server
ntdp 解释 Network topology discovery protocol
ntp-service 解释 Specify NTP (Network Time Protocol) configuration information
oam-mgr 解释 Oam-mgr view
observe-port 解释 Configure observe port feature
ospf 解释 Open Shortest Path First (OSPF)
ospfv3解释 OSPF version 3 for IPv6
pim 解释 Specify PIM(Protocol Independent Multicast) configuration information
ping 解释 Ping function
policy-based-route 解释 Specify a policy for policy based routing
port-group 解释 Port-group
port-isolate 解释 Port isolate
port-mirroring 解释 Mirror port
portal 解释 Configure Portal local server
portswitch 解释 Switch port between router and switch mode
pppoe 解释 PPPOE
pw-template 解释 Specify PW template configuration
qos 解释 QoS configuration
quit 解释 Exit from current command view
radius-server 解释 Add or delete RADIUS server template
refresh 解释 Refresh routes to I/O board
reset 解释 Reset operation
return 解释 Exit to user view
rip 解释 RIP (Routing Information Protocol)
ripng 解释 RIPng (Routing information next generation protocol)
rmon 解释 Specify RMON configuration
rmon2 解释 Specify RMON2 configuration
route 解释 Routing Mole
route-policy 解释 Route-policy
route-policy-change 解释 Specify route policy change parameter
router 解释 Configure router information
rrpp 解释 Rapid ring protection protocol
rsa 解释 Specify RSA mole configuration information
scp 解释 Set SCP server
screen-width 解释 Set screen width
script-string 解释 Define a modem script-string
sep 解释 Smart ethernet protection
service 解释 Toggle service mode. By default it is off
set 解释 Set
sftp 解释 Set SFTP service attribute
smart-link 解释 Smart link configuration information
snmp-agent 解释 Specify SNMP (Simple Network Management Protocol) configuration information
ssh 解释 Set the SSH (secure shell) configuration attribute
stack 解释 Stack
static-lsp 解释 Static LSP configuration
stelnet 解释 Set Stelnet service attribute
stp 解释 Specify Spanning Tree Protocol (STP) configuration information
super 解释 Modify super password parameters
sysname 解释 Specify the host name
tcp 解释 Specify TCP(Transmission Control Protocol) configuration information
telnet 解释 Set the status of the Telnet service
temperature 解释 Device temperature
test-aaa 解释 Accounts test
test-packet 解释 Set the test packet
tftp 解释 Establish a TFTP connection
tftp-server 解释 TFTP server
time-range 解释 Specify time-range configuration information
trace 解释 Trace route (switch) to host on Data Link Layer
tracert 解释 Trace route to host
traffic 解释 Specify traffic configuration information
traffic-delete 解释 Delete sacl
traffic-filter 解释 Filter packets based on acl
traffic-limit 解释 Limit the rate of the packets based on acl
traffic-mirror 解释 Mirror packets based on acl
traffic-policy 解释 Apply specific traffic policy
traffic-redirect 解释 Redirect packets based on acl
traffic-remark 解释 Remark packets based on acl
traffic-statistic 解释 Count packets based on acl
trunk 解释 Trunk interface
ttl 解释 Time to live
tunnel-selector 解释 Tunnel-policy selector
udp-helper 解释 UDP Helper
undo 解释 Cancel current configuration
unknown-unicast 解释 Unknown unicast
upgrade 解释 Upgrade software online
user-bind 解释 User bind
user-group 解释 User group
user-interface 解释 Configure the user terminal interface
vlan 解释 Virtual LAN
voice-vlan 解释 Voice VLAN
vrrp 解释 Specify configuration information about VRRP
web-auth-server 解释 Portal authentication server
8. CentOS7 sshd
http://blog.csdn.net/capricorn90/article/details/52578856
实验环境:CentOS7 Minimal安装,安装过程及软件包见 http://blog.csdn.net/capricorn90/article/details/52556174
SSH的英文全称是Secure SHell。通过使用SSH,你可以把所有传输的数据进行加密,这样“中间人”这种攻击方式就不可能实现了,而且也能够防止DNS和IP欺骗。还有一个额外的好处就是传输的数据是经过压缩的,所以可以加快传输的速度。SSH有很多功能,它既可以代替telnet,又可以为ftp、pop、甚至ppp提供一个安全的“通道”。
SSH在Linux中的服务是sshd,安装openssh后才可开启。CentOS 7 安装后默认情况下是不启动sshd服务,即无法通过ssh服务远程连接。
首先查看系统是否安装openssh,一般情况想都是默认安装了,
如果没有安装可以通过yum在线安装。
简单的设置就是在命令行中启动sshd服务。这样做比较快捷直接,但是只能对当前状态有效,一旦重启系统就丢失了该服务。
通过systemctl命令可以将sshd服务加到开机自启动列表里。实现开机自动启动sshd服务。
在sshd_config文件中存放了端口、控制策略等信息。
首先修改端口,端口设置为自定义端口,即1024之后的端口,这里设置为8090。
禁止空密码用户登录。
开启密码登录授权(默认即开启)
禁止root账户使用ssh登录,这种设置通常用于互联网服务器,防止提权后用root账户登录搞破坏。
注意其中关于port的提示文字
修改端口的时候需要添加到防火墙的控制中,否则无法使用ssh连接。
semanage只是端口工具,修改防火墙只能使用firewall-cmd
9. Linux shell常用命令
Linux shell常用命令汇总
对于经常使用linux系统的博主来说,基本常用的shell命令是少不了的,下面为大家总结了Linux shell的常用命令,希望对大家有所帮助!
1.检查远程端口是否对bash开放:
echo >/dev/tcp/8.8.8.8/53 && echo "open"
2.让进程转入后台:
Ctrl + z
3、将进程转到前台:
fg
4.产生随机的十六进制数,其中n是字符数:
openssl rand -hex n
5.在当前shell里执行一个文件里的命令:
source /home/user/file.name
6.截取前5个字符:
${variable:0:5}
7.SSH debug 模式:
ssh -vvv user@ip_address
8.SSH with pem key:
ssh user@ip_address -i key.pem
9.用wget抓取完整的网站目录结构,存放到本地目录中:
wget -r --no-parent --reject "index.html*" http://hostname/ -P /home/user/dirs
10.一次创建多个目录:
mkdir -p /home/user/{test,test1,test2}
11.列出包括子进程的进程树:
ps axwef
12.创建 war 文件:
jar -cvf name.war file
13.测试硬盘写入速度:
dd if=/dev/zero of=/tmp/output.img bs=8k count=256k; rm -rf /tmp/output.img
14.测试硬盘读取速度:
hdparm -Tt /dev/sda
15.获取文本的md5 hash:
echo -n "text" | md5sum
16.检查xml格式:
xmllint --noout file.xml
17.将tar.gz提取到新目录里:
tar zxvf package.tar.gz -C new_dir
18.使用curl获取HTTP头信息:
curl -I http://www.example.com
19.修改文件或目录的时间戳(YYMMDDhhmm):
touch -t 0712250000 file
20.用wget命令执行ftp下载:
wget -m ftp://username:password@hostname
21.生成随机密码(例子里是16个字符长):
LANG=c < /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16};echo;
22.快速备份一个文件:
cp some_file_name{,.bkp}
23.访问Windows共享目录:
smbclient -U "DOMAIN\user" //dc.domain.com/share/test/dir
24.执行历史记录里的命令(这里是第100行):
!100
25.解压:
unzip package_name.zip -d dir_name
26.输入多行文字(CTRL + d 退出):
cat > test.txt
27.创建空文件或清空一个现有文件:
\> test.txt
28.与Ubuntu NTP server同步时间:
ntpdate ntp.ubuntu.com
29.用netstat显示所有tcp4监听端口:
netstat -lnt4 | awk '{print $4}' | cut -f2 -d: | grep -o '[0-9]*'
30.qcow2镜像文件转换:
qemu-img convert -f qcow2 -O raw precise-server-cloudimg-amd64-disk1.img \precise-server-cloudimg-amd64-disk1.raw
31.重复运行文件,显示其输出(缺省是2秒一次):
watch ps -ef
32.所有用户列表:
getent passwd
33.Mount root in read/write mode:
mount -o remount,rw /
34.挂载一个目录(这是不能使用链接的情况):
mount --bind /source /destination
35.动态更新DNS server:
nsupdate < <eof p=""> </eof>
update add $HOST 86400 A $IP
send
EOF
36.递归grep所有目录:
grep -r "some_text" /path/to/dir
37.列出前10个最大的文件:
lsof / | awk '{ if($7 > 1048576) print $7/1048576 "MB "$9 }' | sort -n -u | tail
39.打开Vim并跳到文件末:
vim + some_file_name
40.Git 克隆指定分支(master):
git clone [email protected]:name/app.git -b master
41.Git 切换到其它分支(develop):
git checkout develop
42.Git 删除分支(myfeature):
git branch -d myfeature
43.Git 删除远程分支
git push origin :branchName
44.Git 将新分支推送到远程服务器:
git push -u origin mynewfeature
45.打印历史记录中最后一次cat命令:
!cat:p
46.运行历史记录里最后一次cat命令:
!cat
47.找出/home/user下所有空子目录:
echo >/dev/tcp/8.8.8.8/53 && echo "open"
1.检查远程端口是否对bash开放:
find /home/user -maxdepth 1 -type d -empty
48.获取test.txt文件中第50-60行内容:
< test.txt sed -n '50,60p'
49.运行最后一个命令(如果最后一个命令是mkdir /root/test, 下面将会运行: sudo mkdir /root/test):
sudo !!
50.创建临时RAM文件系统 – ramdisk (先创建/tmpram目录):
mount -t tmpfs tmpfs /tmpram -o size=512m
51.Grep whole words:
grep -w "name" test.txt
52.在需要提升权限的.情况下往一个文件里追加文本:
echo "some text" | sudo tee -a /path/file
53.列出所有kill signal参数:
kill -l
54.在bash历史记录里禁止记录最后一次会话:
kill -9 $$
55.扫描网络寻找开放的端口:
nmap -p 8081 172.20.0.0/16
56.设置git email:
git config --global user.email "[email protected]"
57.To sync with master if you have unpublished commits:
git pull --rebase origin master
58.将所有文件名中含有”txt”的文件移入/home/user目录:
find -iname "*txt*" -exec mv -v {} /home/user \;
59.将文件按行并列显示:
paste test.txt test1.txt
60.shell里的进度条:
pv data.log
61.使用netcat将数据发送到Graphite server:
echo "hosts.sampleHost 10 `date +%s`" | nc 192.168.200.2 3000
62.将tabs转换成空格:
expand test.txt > test1.txt
63.Skip bash history:
< space >cmd
64.去之前的工作目录:
cd -
65.拆分大体积的tar.gz文件(每个100MB),然后合并回去:
split –b 100m /path/to/large/archive /path/to/output/files
cat files* > archive
66.使用curl获取HTTP status code:
curl -sL -w "%{http_code}\\n" www.example.com -o /dev/null
67.设置root密码,强化MySQL安全安装:
/usr/bin/mysql_secure_installation
68.当Ctrl + c不好使时:
Ctrl + \
69.获取文件owner:
stat -c %U file.txt
70.block设备列表:
lsblk -f
71.找出文件名结尾有空格的文件:
find . -type f -exec egrep -l " +$" {} \;
72.找出文件名有tab缩进符的文件
find . -type f -exec egrep -l $'\t' {} \;
73.用”=”打印出横线:全选复制放进笔记
printf '%100s\n' | tr ' ' = ;