原创

Linux与Mac系统常用命令

常用命令:

vim、tail、top、losf、mkdir、rm、chmod、chown、mv、cp、find、touch、tar、which、whereis、pwd、kill -9、netstat、ping、ps -ef|grep java、free、cat、iostat 2


//查看用户相应信息,如用户jenkins
id  jenkins

//查找文件和应用
whereis git
which git

//查找并显示用户信息。如
finger  -lmsp  yunfeiyang

//修改文件或目录权限
sudo chmod  -R 777  test_dir

//赋值目录给用户test1权限
chown -R test1 test_dir

//彻底删除文件或目录
rm -rf  test_file/test_dir

netstat | grep ESTABLISH | wc -l 命令获得保持连接状态的TCP请求数量
每隔一秒打印一次:do  netstat | grep ESTABLISH | wc -l ; sleep 1; done;
系统系统描述:系统需要能支撑每天1000万活跃用户的使用,每天完成100万交易

//显示隐藏文件和关闭隐藏文件
defaults write com.apple.finder AppleShowAllFiles -bool true
defaults write com.apple.finder AppleShowAllFiles -bool false

//编辑文本文件
vi  /etc/ bashrc
键入键盘中的i,打开编辑状态
输入数据内容后,敲击键盘的esc健,退出编辑状态
输入:号,然后输入wq!保存并退出,如果只要退出,就输入:q!

//修改系统版本号,先要sudo -s,然后chmod 777
more /System/Library/CoreServices/SystemVersion.plist
vi /System/Library/CoreServices/SystemVersion.plist

查看目录的权限
ls -ld /usr/local/

改变目录权限
sudo chmod a+w /usr/local/Cellar

//查看系统端口
ps -ef|grep mysqld
使用“lsof -i4”直接显示进程和端口的对应信息:  lsof -i: 端口号


如何看linux是32位还是64位
file  /bin/ls
cat /proc/version

查看系统网络配置
ifconfig


查找文件或进程

ps -ef|grep java


关闭防火墙

systemctl stop firewalld.service

systemctl status firewalld.service


正文到此结束
本文目录