Linux命令使用

  • 命令行创建设置用户密码
$ sudo useradd -m -r username
$ cat "username:password" | sudo chpasswd -m
  • 查询usb设备信息
$ lsusb
# 查询详细信息
$ lsusb -v
  • 查询usb设备对应的/dev文件
# 获取usb设备总线信息
$ lsusb
Bus 002 Device 004: ID 413c:2107 Dell Computer Corp. 
Bus 002 Device 003: ID 0461:4d81 Primax Electronics, Ltd Dell N889 Optical Mouse
Bus 002 Device 015: ID 05ac:12a8 Apple, Inc. iPhone5/5C/5S/6
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ ls /dev/bus/usb/002/
001  002  003  004  015
  • 查询文件或者设备进程占用情况
$ sudo fuser /dev/bus/usb/002/015
/dev/bus/usb/002/015:  3036
$ ps -ef|grep 3036
  • 查询磁盘使用情况
### 查询磁盘使用情况
# df -h
### 查询目录大小
# du -h
  • find多文件名匹配
# find /etc/ansible/roles -name "ubuntu-16.04.yml" -o -name "debian.yml"
  • 文本输出去重
# sort -u file.txt
  • 连接/监听端口
### 使用netcat工具
# nc 127.0.0.1 80
# nc -l 80
  • 下载文件
# curl -o <file> <url>
posted @ 2017-10-14 10:04  银魔术师  阅读(186)  评论(0编辑  收藏  举报