ubuntu18.04常用操作

安装 chrome

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

sudo dpkg -i google-chrome-stable_current_amd64.deb

安装网络工具

 sudo apt install -y net-tools
 sudo apt install -y iputils-ping
 sudo apt install -y telnet

安装 vim

sudo apt install -y vim

启动 springboot 程序

nohup java -Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8100 -jar coffee-1.0.jar --spring.config.location=application.yml,application-dev.yml --logging.config=logback.xml 2>&1 &

查询进程并 kill

kill -9 `ps -ef|grep coffee-1.0.jar | grep -v grep|awk '{print $2}'`
ps -ef | grep hello | grep -v grep | awk '{print $2}' | xargs kill -9

dos2unix

sudo apt install -y dos2unix
dos2unix t.sh
dos2unix *

修改mydir 目录所属用户和组

chown -R mm:mm mydir

kvm

# 查看镜像信息
qemu-img info bionic-server-cloudimg-amd64.img
# 把 vmware 虚拟机转化成 qcow2 
qemu-img convert -f vmdk -O qcow2 Windows_Server_2019_1909-disk1.vmdk w2019.img

ssh

终端与服务器保持心跳,编辑文件

 vim /etc/ssh/ssh_config

添加配置

 ServerAliveInterval 30
 ServerAliveCountMax 10

hash计算

md5sum master.ova

不能与主机共享剪贴板(vmware)

apt update
apt install open-vm-tools open-vm-tools-desktop
reboot

搜索日志

cat xxx.log | grep key
grep -a key xxx.log  #解决Binary file (standard input) matches
grep -rn "xxx" * #递归搜索所有文件,并且显示行号

查看安装软件的版本

dpkg -l | grep nfs

开启远程桌面

在这里插入图片描述
开启后,客户端包安全错误,可取消加密

gsettings set org.gnome.Vino require-encryption false

连接windows server 2012 r2 远程桌面

使用 Remmina, 可远程连接 windows系统桌面,如下图:
ubuntu 18.04 连接 windows系统桌面

连接出错解决

如果连接出现如下错误:
You requested an H264 GFX mode for server app.localhost.com, but your libfreerdp does not support H264. Please check Color Depth Settings
解决:

# 添加 remmina 仓库
sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt update

#重新安装 remmina
sudo apt install remmina remmina-plugin-rdp remmina-plugin-secret

#关掉所有 remmina 进程
sudo killall remmina

参考:https://blog.youkuaiyun.com/Joker00007/article/details/112950609

切换到root

#使用当前用户环境
sudo -s
#同时切换到root用户环境
sudo su

git linux和windows换行符差异解决

大部分时候在windows上开发,有时候需要在linux上调试。因为换行符的差异,linux上看到所有文件都被改变了。在linux系统上项目目录下,执行命令

git config core.autocrlf input

测试磁盘读写速度

 time dd if=/dev/zero of=t.img bs=32k count=102400 #写速度
 time dd if=t.img of=/dev/null bs=32k

openssl

 openssl pkey -in apiserver.key -noout -text #查看秘钥
 openssl x509 -in apiserver.crt -noout -text #查看证书

ubuntu云镜像设置root用户密码

sudo apt install libguestfs-tools
#把root密码设置为123456
virt-customize -a focal-server-cloudimg-amd64.img --root-password password:123456

锁定内核版本

sudo apt-mark hold linux-image-5.4.0-148-generic
sudo apt-mark hold linux-headers-5.4.0-148-generic
sudo apt-mark hold linux-modules-5.4.0-148-generic
sudo apt-mark hold linux-modules-extra-5.4.0-148-generic

ubuntu历史版本

https://old-releases.ubuntu.com/releases/20.04.4/

#dhcp refresh ip

sudo dhclient -r enp0s8
sudo dhclient enp0s8

查看系统状态

cpu

top 1

or

mpstat -P all 1

内存

vmstat 1

磁盘

iostat -d -k 1
iotop -oP

进程

pidstat -t -p xx 1 #thread
pidstat -w -p xx 1 #上下文切换

查看 docker 绑定

docker inspect xxx|grep Pid
taskset -c -p yyy

openssh 加解密文件

#加密
openssl enc -e -aes256 -in xfuzzserver.zip -out xfuzzserver.aes
#解密
openssl enc -d -aes256 -in xfuzzserver.aes -out xfuzzserver.zip
### 常用工具列表 for Ubuntu 18.04 LTS 对于Ubuntu 18.04 LTS用户来说,有许多实用的工具可以提高工作效率并增强系统的功能。以下是几个推荐的应用程序: #### 开发环境构建 - **Git**: Git是一个分布式版本控制系统,用于跟踪计算机文件的变化,并协调多人对同一组文件的工作[^3]。 ```bash sudo apt install git ``` - **Python及其开发库**: Python是一种广泛使用的高级编程语言。 ```bash sudo apt-get install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools ``` #### 文件管理与操作 - **Rsync**: Rsync是一款快速、多功能、远程(以及本地)文件复制工具。 ```bash sudo apt install rsync ``` #### 图形界面应用 - **GIMP (GNU Image Manipulation Program)**: GIMP是一套免费且开源的照片修饰程序及绘图工具。 ```bash sudo apt install gimp ``` - **Inkscape**: Inkscape是创建矢量图形的理想选择,支持SVG格式。 ```bash sudo apt install inkscape ``` #### 终端增强工具 - **Zsh + Oh My Zsh**: 更加友好的终端体验,Oh My Zsh提供了丰富的插件和主题来定制zsh shell的行为。 ```bash sudo apt install zsh sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" ``` #### 网络诊断工具 - **Net-tools 和 iproute2**: 这些包包含了ifconfig, netstat等网络配置命令行工具;而`ip`则是更现代的选择。 ```bash sudo apt install net-tools iproute2 ``` #### 数据库管理系统 - **MySQL/MariaDB服务器**: 关系型数据库管理系统,适合Web应用程序和其他需要强大数据处理能力的服务。 ```bash sudo apt install mysql-server mariadb-server ``` #### 文本编辑器 - **Vim 或者 Visual Studio Code**: Vim是非常轻便高效的文本编辑器之一;Visual Studio Code则集成了许多开发者喜爱的功能特性。 ```bash sudo snap install --classic code # This installs the latest stable version of VSCode via Snap store. sudo apt install vim-gtk3 # For GUI support with VIM ``` 这些只是冰山一角,在实际使用过程中还可以根据个人需求探索更多有用的软件和服务。希望这份清单能够帮助到正在寻找合适工具的朋友!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值