.Net Core 下Linux常用命令
查看linux版本:lsb_release -a
删除带有特殊字符的文件,先用ls -i 查找文件的inode,然后用find命令删除:find ./ -inum 393476 -exec rm {} \;
删除带有特殊字符的目录,可以用引号把目录引起来:rm -rf "a\b"
查看文件格式:file 文件路径
去掉windows系统下的换行符\r:sed -i 's/\r//g' file
在整个系中查找文件夹:find / -name 'yishagit' -type d
查看rpm包的安装路径,比如查看git,rpm -qa | grep git,然后再rmp -ql 软件包安装的文件
查看所有用户 cat /etc/passwd |cut -f 1 -d :
vim
:wq 强制性写入文件并退出,即时文件没修改,也强制写入,并更新文件修改时间。
:x 写入文件并退出,仅当文件被修改时才写入,并更新文件修改时间。
nginx安装参数,支持ssl
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
./configure \ --prefix=/usr/local/nginx \ --conf-path=/usr/local/nginx/conf/nginx.conf \ --pid-path=/usr/local/nginx/conf/nginx.pid \ --lock-path=/var/lock/nginx.lock \ --error-log-path=/var/log/nginx/error.log \ --http-log-path=/var/log/nginx/access.log \ --with-http_gzip_static_module \ --http-client-body-temp-path=/var/temp/nginx/client \ --http-proxy-temp-path=/var/temp/nginx/proxy \ --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \ --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \ --http-scgi-temp-path=/var/temp/nginx/scgi \ --with-http_ssl_module \ --with-openssl=../openssl-1.0.2r \ --with-openssl-opt="enable-tlsext" \
查看Nginx是否启动 ps -ef | grep nginx
配置Nginx开机自动启动:https://www.cnblogs.com/piscesLoveCc/p/5867900.html
Nginx重新加载配置,进入nginx可执行目录sbin下,输入命令./nginx -s reload
Nginx服务重启 service nginx restart
Nginx服务停止 service nginx stop
supervisord配置文件路径:/etc/supervisord.d
查看supervisor状态 supervisorctl status
重启某一个程序 supervisorctl restart program_name
重新加载所有的程序 supervisorctl reload
CentOS
删除某个软件,比如subversion
先查找包 yum list installed "subversion",然后删除 yum remove subversion.x86_64
查看git版本:git remote -v
git pull 拉取远程代码并合并到本地
git commit –m "" 提交到本地库
git push origin master 推送到远程库
git mergetool 解决冲突
git add * 增加文件到staging
git status 查看staging里面的文件
git 常用命令 https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html
MySql 8.0 重置数据库密码
systemctl stop mysqld.service
mysqld --skip-grant-tables --user=mysql &
mysql
FLUSH PRIVILEGES;
ALTER USER 'root'@'%' IDENTIFIED BY 'new_password';
systemctl stop mysqld.service
systemctl restart mysqld.service
https://www.tecmint.com/reset-root-password-in-mysql-8/
MySql 8.0 允许远程连接
mysql -u root -p
use mysql
update user set host='%' where user ='root';
FLUSH PRIVILEGES;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
Redis
首先控制台redis-cli
查看所有的keys:key *
通过key获取value:mget key
删除key:del key
Redis清空所有key
redis-cli
flushall