linux常用操作

ubuntu: run program on startup

system invokes ~/.bashrc on startup. so we can do setup things in this file. we can do release or backup things in ~/.bash_logout file.

查看进程内存占用情况

`ps -ef` :获取进程ID `cat /proc/proc_id/status` 查看某个进程或服务是否开启 `ps -aux | grep xxxservice xxx status` 查看所有服务的状态 ` service --status-all`

解压和压缩

`tar -xzvf xxx.tar.gz tar -czvf xxx.tar.gz ./xxx`

virtualbox mount

`virtualbox mount -t vboxsf source /mnt/e/source`

如何避免升级LTS版本

换更新源时注意版本对应,16.04 (代号 Xenial Xerus),18.04(Bionic Beaver),20.04 (Focal Fossa)

How to run sudo command without a password on a Linux or Unix

  1. Backup your `/etc/sudoers` file by typing the following command: `sudo cp /etc/sudoers /root/sudoers.bak`
  2. Edit the `/etc/sudoers` file by typing the visudo command: `sudo visudo`
  3. Append/edit the line as follows in the `/etc/sudoers` file for user named ‘vivek’ to run ‘/bin/kill’ and ‘systemctl’ commands: `vivek ALL = NOPASSWD: /bin/systemctl restart httpd.service, /bin/kill` example `lee ALL=(ALL) NOPASSWD:ALL`

安装openssh-server

正常情况下直接执行 `sudo apt install openssh-server` 即可,如果无法安装,可能是因为已经安装了 openssh-client,并且版本过你导致,可执行 `sudo apt remove openssh-client & sudo apt autoremove` 然后再执行前面那句

设置时区

正常情况下,执行以下命令即可:

# ubuntu:
tzselect
# centos:
timedatectl set-timezone Asia/Shanghai

如果 tzselect 报错 "/usr/share/zoneinfo/iso3166.tab: No such file or directory" ,则需要执行:

apt install tzdata
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值