ubuntu常用配置

创建账户并设置可以sudo

1.adduser jax ... #跟着提示走
2.sudo vim /etc/sudoersroot ALL=(ALL:ALL) ALL下添加jax ALL=(ALL:ALL) ALL

后台任务

nohup command & 后台执行命令
jobs 查看后台任务
fg 1 将id为1的任务放到前台
bg 1 将id为1的任务放到后台执行

设置账户可以ssh登陆

vim /etc/ssh/sshd_config 添加AllowUsers root jax(多个用户用空格隔开),重启ssh服务

命令行ssh上传文件

scp a.txt jax@remote:/home/jax/上传a.txt到remote服务器(remote是服务器ip)的/homr/jax/目录
scp -r a jax@remote:~上传目录

重启/停止/开启服务

/etc/init.d/restart fail2ban.service 重启fail2ban服务

设置服务随系统启动

systemctl enable nginx.service

查看服务状态

systenctl status fail2ban.service查看服务状态

设置时区

tzselect #跟着提示走 选择时区
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date

常用命令

last查看登陆记录
lastb查看登陆失败的记录
netstat -ltn查看端口占用
lsof -i :8000查看占用8000端口的进程状态
kill 3396杀掉id为3396的进程
history查看当前账号的操作记录
cat暂时未知
cp /etc/A /etc/B复制A的内容到B
ln -s /etc/A /etc/B建立A和B的软连接,或者说将B看做是A的引用
rm /etc/B删除B,如果B是A的软连接,则删除软连接
rm -rf B删除文件夹
ls /etc列出/etc下的所有文件和文件夹
dir列出当前目录下的所有文件和文件夹

你可能感兴趣的:(ubuntu常用配置)