当前位置: 首页 > Linux

Linux常用命令

时间:2023-04-06 18:18:36 Linux

Linux常用命令集本笔记是笔者整理的一些简单实用的Linux命令,供日常参考。文件权限和用户权限#changefilemodchmod+rwxfilechmod777file#数字模式用二进制计算,三位数字分别代表owner,group,others,4-r,w-2,x-1,然后7=4+2+1=rwxchown-croot./hello.txt#将所有者更改为rootchgrp-croot./hello.txt#将组更改为root#更改登录shell:chsh#或编辑/etc/passwd.#get/cygwin系统中etc/passwd文件:mkpasswd-c|sed-e'sX/bashX/zshX'|tee-a/etc/passwdfileviewandsearch#显示文本文件,显示,查看文件开头,查看文件结尾catfile|lessheadfiletailfile#find[path][expr]find/var/usr-name"*.pdf"#使用-iname忽略A或afind/var-name"*.pdf"-a"*.txt"#-ameansandfind/var-name"*.pdf"-typed#d表示dirfind/var-name"*.pdf"-size+100c#+100c表示超过100个字符.find.name"*.sh"-typef-execcat{}\;#为所有找到的文件运行`cat`。寻找。-typef-mmin-10#过去10分钟内更改的任何文件。寻找。-ctime-10#更改时间,按天.ctime=更改时间,mtime=修改时间,atime=accesstime.locale#与find类似,但速度更快,因为使用了日期库(每天更新一次)。#在PATHwhichprogName中搜索bin文件路径#在systemwhereisprogNameapropos中搜索bin文件路径#LookingforcommandtypeCMDwithXXXfunction#确保cmd来自bash或exec。文件,文件系统管理lnsource_filetarget_dir#制作软链接:ln-ssource_file_or_dirtarget_dirtar-cvfto_filenameform_dir#自动识别后缀名压缩tar-tvffilename#自动识别后缀名浏览文件目录tar-xvffilename#自动识别后缀名和decompress#Tar其他选项:c:create,x:decompress,t:view#!!!非常有用!!!#也适用于mac#检查finder的磁盘使用情况du-sh./*用户管理userdelusernameuseraddusernamegroupaddgroupnamegroupdelgroupname进程管理ps#列出所有进程top#一个管理进程的交互程序lsof#列出打开的fileskill234#killaprocessbypidnice#runaprogramwithmodifiedschedulingpriorityrenice#alterpriorityofrunningtoryprocessother#commandhistoryid#myuidgidetc.fsck.ext4-p/dev/sdb1#rapairEXT4文件系统