您的位置:首页 > 运维架构 > Linux

Linux Command Line

2017-04-05 23:15 225 查看
文件解压缩

unpacking or uncmpressing .gz files under linux and unix

$ gunzip file.gz  #

$ gzip -d file.gz #

$ tar -zxvf file.tar.gz -C /opt/gopath # -C(Uppercase)指定目录 (change to directory DIR)

$ iconv -f gbk -t utf-8

$ dos2unix -o file.a file.b


Print Working Directory

# pwd -LP
/home/timgise


Ubuntu Package Manager软件包管理

Advanced Packing Tool (APT)

Print network connections, routing tables, interface statistics, masquerade connections, and multi‐cast memberships

netstat -tlunp  ## {-t|tcp} {-u|--udp} {-l|--listening} {-n|--numberic}


iptables/ip6tables — administration tool for IPv4/IPv6 packet filtering and NAT

iptables -L ## {-L|--list} List the rules in a chain or all chains

保存当前防火墙规则,必要时恢复

iptables-save > /etc/iptables-up-rules  #保存
iptables-restore < /etc/iptables-up-rules # 恢复


添加用户、工作目录、设置密码

$ useradd -d /home/dev -m  -s /bin/bash dev
$ passwd dev


修改SSH服务端口(ubuntu server)

$ vi /etc/ssh/sshd_config # Port 22

重启sshd服务

$ sudo service sshd restart


Add user to the sudo group

usermod -aG sudo tomcat7 ##
sudo vi /etc/group ## 查看系统所有用户组


Disk Free

df -h  # Human readable output


Memory Usage

free -m  # displays all data im MBs


lshw - list hardware

lshw -C network
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux Ubuntu