Linux common commands,Tips: Ctrl + F to quickly find Linux commands (click the title to shrink and expand)
code command | ຄຳສັ່ງ comment description |
---|---|
Arch | Display the processor architecture of the machine (1) |
Uname -m | Display the processor architecture of the machine (2) |
Uname -r | Display the kernel version in use |
Dmidecode -q | Display Hardware System Components - (SMBIOS/DMI) |
HDPARM -i /dev/hda | List the architectural characteristics of a disk |
HDPARM -tT /dev/sda | Perform a test read operation on disk |
Cat /proc/cpuinfo | ສະແດງຂໍ້ມູນ CPU |
Cat /proc/interrupts | ສະແດງການລະເບີດ |
Cat /proc/meminfo | ການກວດຄຳໃຊ້ຄອມມູນ |
Cat /proc/swaps | Shows which swaps are being used |
Cat /proc/version | Show the version of the kernel |
Cat /proc/net/dev | Display network adapters and statistics |
Cat /proc/mounts | ສະແດງລະບົບເອກະສານທີ່ໄດ້ນຳໃຊ້ |
LSPCI -TV | ສະແດງເຄື່ອງມືPCI |
LSUSB -TV | ສະແດງເຄື່ອງມືUSB |
Date | ສະແດງປີເວລາຂອງລະບົບ |
Cal 2007 | ສະແດງປະຕາວິດສະຫຼອງ 2007 |
Date 04121700 2007.00 | ການກຳນົດປີແລະເວລາ - month, day, hour, year. seconds |
Clock -w | ບັນທຶກການປ່ຽນເວລາໄວຣັດ |
code command | ຄຳສັ່ງ comment description |
---|---|
ປິດລະບົບ -h now | ປິດລະບົບ |
Init 0 | ປິດລະບົບ |
Telinit 0 | ປິດລະບົບ |
ປິດລະບົບ -h hours: minutes & | ປິດລະບົບຫຼືບໍ່ທີ່ມີການກຳນົດ |
ປິດລະບົບ -c | ຍົກເລີກປິດລະບົບຫຼືບໍ່ທີ່ມີການກຳນົດ |
ປິດລະບົບ -r now | ເລີ່ມໃໝ່ |
Reboot | ເລີ່ມໃໝ່ |
ປອດສະຫຼະ | ຍົກເລີກ |
code command | ຄຳສັ່ງ comment description |
---|---|
CD /home | ໄປຫາ '/ສາກການ'home'. |
CD.. | ກັບຄືນໄປສາກການຫຼັກຫຼືບໍ່ |
CD../.. | ກັບຄືນໄປສາກການສອງລະດັບຫຼືບໍ່ |
CD | ເຂົ້າໄປສາກການບໍລິສຸກຊົນປະຊາຊົນ |
Cd~ user1 | ເຂົ້າໄປສາກການບໍລິສຸກຊົນປະຊາຊົນ |
CD - | ກັບຄືນໄປສາກການທີ່ເຈົ້າຢູ່ຫຼັງຄັ້ງຫຼືບໍ່ |
PWD | ສະແດງຕາມການເຄື່ອນໄຫວ |
ls | ບັນທຶກເອກະສານໃນສາກການ |
LS -F | ບັນທຶກເອກະສານໃນສາກການ |
LS -l | ສະແດງລາຍລະອຽດເອກະສານແລະສາກການ |
Ls -a | ສະແດງເອກະສານລຸ່ມ |
Ls * [0-9] * | ສະແດງຊື່ເອກະສານແລະສາກການທີ່ບັນຈຸທີ່ມີຈຳນວນ |
Tree | ສະແດງສາຍສາກຂອງເອກະສານແລະສາກການຈາກສາກການຫຼັກ |
LSTREE | ສະແດງສາຍສາກຂອງເອກະສານແລະສາກການຈາກສາກການຫຼັກ |
Mkdir dir1 | ສ້າງສາກການທີ່ຊື່ວ່າ'dir'1 '. |
Mkdir dir1 dir2 | ສ້າງສາກການສອງສາກການຫຼືບໍ່ |
Mkdir -p /tmp/dir1/dir2 | ສ້າງສາກການເອກະສານ |
Rm -f file1 | ລຶບເອກະສານທີ່ຊື່ວ່າ'file'1 '. |
Rmdir dir1 | ລຶບສາກການທີ່ຊື່ວ່າ'dir'1 '. |
Rm -rf dir1 | ລຶບສາກການທີ່ຊື່ວ່າ'dir'1 ແລະລຶບເນື້ອໃນນັ້ນຫຼືບໍ່ |
Rm -rf dir1 dir2 | ລຶບສາກການແລະເນື້ອໃນນັ້ນຫຼືບໍ່ |
MV dir1 new_dir | ປ່ຽນຊື່/ປ່ຽນສາກການ |
CP file1 file2 | ສ້າງສາກການເອກະສານ |
CP dir/*. | ສ້າງສາກການຂອງເອກະສານທັງໝົດໃນສາກການປະຈຸບັນ |
CP -A /tmp/dir1. | ສ້າງສາກການໃຫ້ສາກການປະຈຸບັນ |
CP -a dir1 dir2 | ສ້າງສາກການ |
-S file1 lnk1 | ສ້າງການເຊື່ອມຊອບໃຫ້ເອກະສານຫຼືສາກການ |
Ln file1 lnk1 | ສ້າງການເຊື່ອມພາບກາຍໃຫ້ເອກະສານຫຼືສາກການ |
Touch -t 0712250000 file1 | ດັດແປງເວລາຂອງເອກະສານຫຼືສາກການ - (YYMMDDhhmm) |
IconV -l | ສະແດງວັດແທກທີ່ຮູ້ |
iconv -f fromEncoding -t toEncoding inputFile > outputFile | ປ່ຽນການວັດແທກຂອງຄຳສັນ |
Find. -maxdepth 1 -name * .jpg -print -exec convert | Batch resizing files in the current directory and send them to the thumbnail directory (requires conversion from ImageMagick) |
code command | ຄຳສັ່ງ comment description |
---|---|
ການຄົ້ນຫາ/-name file1 | Start with '/' to enter the root file system to search for files and directories |
ການຄົ້ນຫາ/-user user1 | Search for files and directories belonging to user'user'1 ' |
ການຄົ້ນຫາ /home/user1 -name * .bin | Search the directory '/home/user1' for files ending in '.bin' |
ການຄົ້ນຫາ /usr/bin -type f -atime + 100 | Search for executable files that have not been used in the past 100 days |
ການຄົ້ນຫາ /usr/bin -type f -mtime -10 | Search for files that have been created or modified within 10 days |
ການຄົ້ນຫາ/-name * .rpm -exec chmod 755 '{}' ; | Search for files ending in '.rpm' and define their permissions |
ການຄົ້ນຫາ/-xdev -name * .rpm | Search for files ending in '.rpm', ignoring removable devices such as optical drives and flash drives |
Locate * .ps | Find files ending in '.ps' - run the'updatedb 'command first |
Whereis halt | Display the location of a binary, source, or man |
Which halts | ສະແດງທາງສາຍທົ່ວໄປຫາເອກະສານ ຫຼື ບັນນາທິດ |
code command | ຄຳສັ່ງ comment description |
---|---|
ການຫວນ /dev/hda2 /mnt/hda2 | mount a disk called hda2 - make sure the directory '/mnt/hda2' already exists |
Umount /dev/hda2 | ຖອນຕົວດາວໂຫຼດທີ່ຊື່ວ່າ hda2 - exit from the mount point '/mnt/hda2' first |
Fuser -km /mnt/hda2 | ຖອນຕົວຂ້າງຄວາມກຳນົດເວລາທີ່ເຄື່ອງຈັກກຳນົດຢູ່ບັນຫາ |
Umount -n /mnt/hda2 | ການດຳເນີນການຖອນຕົວຂ້າງບໍ່ມີການຂຽນ /etc/mtab file useful when the file is read-ພຽງແຕ່ຫຼື ເວລາທີ່ດາວໂຫຼດມີຄວາມກຳນົດຫຼາຍ |
ການຫວນ /dev/fd0 /mnt/floppy | ຕິດຕັ້ງແຜນການ floppy disk |
ການຫວນ /dev/cdrom /mnt/cdrom | ຕິດຕັ້ງ cdrom ຫຼື dvdrom |
ການຫວນ /dev/hdc /mnt/cdrecorder | ຕິດຕັ້ງ cdrw ຫຼື dvdrom |
ການຫວນ /dev/hdb /mnt/cdrecorder | ຕິດຕັ້ງ cdrw ຫຼື dvdrom |
ການຫວນ -o loop file.iso /mnt/cdrom | ຕິດຕັ້ງແຜນການ ຫຼື ບັນນາທິດ ISO |
ການຫວນ -t vfat /dev/hda5 /mnt/hda5 | ຕິດຕັ້ງແຜນການ Windows FAT32 file system |
ການຫວນ /dev/sda1 /mnt/usbdisk | ຕິດຕັ້ງແຜນການ USB ຫຼື ແຜນການ flash |
ການຫວນ -t smbfs -o username = user, password = pass//WinClient/share /mnt/share | ການຫວນສາຍລະບົບ Windows |
code command | ຄຳສັ່ງ comment description |
---|---|
DF -h | ສະແດງລາຍການຂອງແຜນການຖືກຕິດຕັ້ງ |
LS -lSr | more | ບັນທຶກຫຼັກແລະເສັ້ນຫຼັກຕາມຄວາມໃຫຍ່ |
Du -sh dir1 | ການວັດແທກຂອບຂອງຊຸບຊຸງ 'dir' ທີ່ຖືກໃຊ້ແລ້ວ1' |
Du -sk * | sort -rn | ສະແດງຂອບຂອງຫຼັກແລະເສັ້ນຫຼັກທີ່ຖືກບັນທຶກຕາມຄວາມກຳນົດ |
Rpm -q -a --qf '% 10 {SIZE} t% {NAME} n' | sort -k1,1n | ສະແດງຂອບຂອງຄວາມກຳນົດຂອງຊຸບຊຸງ rpm ທີ່ຖືກຕິດຕັ້ງ ຕາມຄວາມໃຫຍ່ (ລະບົບປະເພດ fedora, redhat) |
Dpkg-ຄຳສັບພາສາ -W -f = '${Installed-Size; 10} t ${Package} n' | sort -k1,1n | Displays the space used by installed deb packages based on size (ubuntu, debian class system) |
code command | ຄຳສັ່ງ comment description |
---|---|
GroupAdd group_name | Create a new user group |
Groupdel group_name | Delete a user group |
Groupmod -n new_group_name old_group_name | Rename a user group |
Useradd -c "Name Surname" -g admin -d /home/user1 -s /bin/bash user1 | Create a user that belongs to the "admin" user group |
UserAdd user1 | Create a new user |
Userdel -r user1 | Delete a user ('-r' excludes home directory) |
Usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 | Modify user properties |
Passwd | Change password |
Passwd user1 | Modify a user's password (only allows root execution) |
Chage -E 2020-12-31 user1 | Set the expiration date for user passwords |
PWCK | Check for file format and syntax fixes for '/etc/passwd' and the existence of users |
GRPCK | Check for file format and syntax fixes for '/etc/passwd' and existing groups |
Newgrp group_name | Log in to a new group to change the default group for newly created files |
code command | ຄຳສັ່ງ comment description |
---|---|
LS -lh | display permission |
LS /tmp | pr -T5 -W $COLUMNS | Divide the end point into 5 columns to display |
Chmod ugo + rwx directory1 | Set permissions for the owner (u), group (g), and others (o) of the directory to read (r), write (w), and execute (x) |
Chmod go-rwx directory1 | Delete group (g) and others (o) read and write execution permissions to directories |
Chown user1 file1 | Change the owner attributes of a file |
Chown -R user1 directory1 | Change the owner attributes of a directory and simultaneously change the attributes of all files in the directory |
CHGRP group1 file1 | Change the group of files |
Chown user1: group1 file1 | Change the owner and group attributes of a file |
ການຄົ້ນຫາ/-perm -u + s | List all files in a system that use SUID control |
Chmod u + s /bin/file1 | Set the SUID bit of a binary file - the user running the file is also given the same permissions as the owner |
CHMOD U-S /bin/file1 | Disable the SUID bit of a binary file |
Chmod g + s /home/public | Set the SGID bit of a directory - similar to SUID, but for directories |
CHMOD G-S /home/public | Disable the SGID bit of a directory |
Chmod o + t /home/public | Set the STIKY bit of a file - only allows the legal owner to delete the file |
CHMOD O-T /home/public | Disable the STIKY bit of a directory |
code command | ຄຳສັ່ງ comment description |
---|---|
Chattr + a file1 | ອະນຸຍາດຂຽນຫຼືອ່າງໃນລະຫວ່າງລະບົບທີ່ບໍ່ສາມາດ |
Chattr + c file1 | ອະນຸຍາດໃຫ້ບັນຊີຈະຖືກຄວບຄຸມຢ່າງອົງອອກ/decompressed by the kernel |
Chattr + d file1 | ໂຄງການ dump ຈະບໍ່ມີການສືບຕໍ່ບັນຊີນີ້ໃນການຖືກຄວບຄຸມລະບົບບັນຊີ |
Chattr + i file1 | ການຕັ້ງໃຫ້ບັນຊີຈະບໍ່ສາມາດລຶບລົງ ດັດເດັດຊື່ ປ່ຽນຊື່ ຫຼື ມາຕິດຕັ້ງ |
Chattr + s file1 | ອະນຸຍາດໃຫ້ລຶບບັນຊີຢ່າງປອດໄພ |
Chattr + S file1 | ເມື່ອການປະຕິບັດຄືບຄານຂອງການຂຽນໃນບັນຊີນີ້ ລະບົບຈະຂຽນຜົນປ່ຽນໃຫ້ໄປໃນວຽງງານຢ່າງທັນທີ |
Chattr + u file1 | ຖ້າບັນຊີຖືກລຶບລົງ ລະບົບຈະອະນຸຍາດໃຫ້ເກັບຄືນບັນຊີຖືກລຶບລົງໃນພາຍຫຼັງ |
Lsattr | ສະແດງປະສົມອາຊີບສະເພາະ |
code command | ຄຳສັ່ງ comment description |
---|---|
Bunzip2 file1.bz2 | ປົດຜ່ານບາດເຟທີ່ຊື່ເປັນ'file1.bz2 ' |
Bzip2 file1 | ຄວບຄຸມບາດເຟທີ່ຊື່ເປັນ'file1 ' |
Gunzip file1.gz | ປົດຜ່ານບາດເຟທີ່ຊື່ເປັນ'file1.gz' |
Gzip file1 | ຄວບຄຸມບາດເຟທີ່ຊື່ເປັນ'file1 ' |
Gzip -9 file1 | ຄວາມຄວບຄຸມຫຼາຍທີ່ສຸດ |
Rar a file1.rar test_file | ສ້າງຕົວຫຼັກທີ່ຊື່ເປັນ'file1.rar ' |
Rar a file1.rar file1 file2 dir1 | ການຄວບຄຸມໃນເວລາດຽວກັນ'file1 ',' file2 'and directory'dir1' |
Rar x file1.rar | ປົດຜ່ານຕົວຫຼັກ rar |
Unrar x file1.rar | ປົດຜ່ານຕົວຫຼັກ rar |
Tar -cvf archive.tar file1 | ສ້າງບາດເຟທີ່ບໍ່ຄວບຄຸມ |
Tar -cvf archive.tar file1 file2 dir1 | ສ້າງບາດເຟກັບ'file1 ',' file2 'and'dir1' |
Tar -tf archive.tar | ສະແດງຂໍ້ມູນບາດເຟ |
Tar -xvf archive.tar | ປະກາດຕົວຫຼັກ |
Tar -xvf archive.tar -C /tmp | ປະກາດບາດເຟໃຫ້ໄປໃນ /ສາຍບັນຊີ tmp |
Tar -cvfj archive.tar.bz2 dir1 | ການສ້າງບາດເຟໃນ bzip2 format |
Tar -jxvf archive.tar.bz2 | ປົດຜ່ານບາດເຟໃນ bzip2 format |
Tar -cvfz archive.tar.gz dir1 | ການສ້າງບາດເຟໃນຮູບແບບ gzip |
Tar -zxvf archive.tar.gz | ປົດຜ່ານບາດເຟໃນຮູບແບບ gzip |
ບາດເຟ.zip1ບາດເຟ.zip1 | ການສ້າງບາດເຟ |
Zip -r file1ບາດເຟ.zip1 file2 dir1 | ການຄວບຄຸມເອຟ ບາດເຟ ແລະ ສາຍບັນຊີໃນເວລາດຽວກັນ |
ປົດຜ່ານເອຟ ບາດເຟ1.zip | ປົດຜ່ານເອຟ ບາດເຟ |
code command | ຄຳສັ່ງ comment description |
---|---|
Rpm -ivh package.rpm | ຕິດຕັ້ງຕົວຫຼັກ rpm |
Rpm -ivh --ຕົວຫຼັກ nodeeps.rpm | ການຕິດຕັ້ງຕົວຫຼັກ rpm ທີ່ບໍ່ຕ້ອງການເຕືອນຄວາມຫຼົງຫຼັງ |
rpm -U package.rpm | ປັບປຸງ RPM package ບໍ່ປ່ຽນຂອງເອກະສານການຕິດຕັມ |
Rpm -F package.rpm | ປັບປຸງ rpm package ທີ່ຕິດຕັມຄັດວ່າ |
Rpm -e package_name rpm | Delete an RPM package |
RPM -QA | ສະແດງຊຸບ rpm ທີ່ຕິດຕັມໃນລະບົບ |
Rpm -qa | grep htpd | ສະແດງຊຸບ rpm ທີ່ມີສາມາດ "htpd" ໃນຊື່ |
RPM -Qi package_name | ເອົາຂໍ້ມູນພິເສດກ່ຽວກັບ package ທີ່ຕິດຕັມ |
RPM -qg "System Environments/Daemons" | ສະແດງ rpm package ຂອງເຄື່ອງກິລາ |
RPM -QL package_name | ສະແດງລາຍການເອກະສານທີ່ສະໜອງໂດຍ rpm package ທີ່ຕິດຕັມ |
RPM -QC package_name | ສະແດງລາຍການເອກະສານການຕິດຕັມທີ່ສະໜອງໂດຍ rpm package ທີ່ຕິດຕັມ |
RPM -Q package_name --WhatRequires | ສະແດງລາຍການຂໍ້ພິຈາລະນາທີ່ຕິດຕັມກັບ rpm package |
RPM -q package_name --WhatProvides | ສະແດງຄວາມຫຼຸດຂອງ rpm package |
Rpm -q package_name --scripts | ສະແດງສະບັບທີ່ເຕີມໃນຂະບວນຕິດຕັມ/removal |
RPM -Q package_name --Changelog | ສະແດງປະຫວັດສານການແປງໃຫຍ່ RPM package |
RPM -QF /etc/httpd/conf/httpd.conf | ຢືນຢັນ RPM package ທີ່ສະໜອງເອກະສານດັ່ງກ່າວ |
Rpm -qp package.rpm -l | ສະແດງລາຍການເອກະສານທີ່ສະໜອງໂດຍ rpm package ທີ່ບໍ່ໄດ້ຕິດຕັມ |
RPM --import /media/cdrom/RPM-GPG-KEY | ນໍາເອນ ສາວິດຫຼັກຖານການຕິດຕັມ |
Rpm --checksig package.rpm | ຢືນຢັນຄວາມສຳຄັນຂອງ RPM package |
Rpm -qa gpg-pubkey | ຢືນຢັນຄວາມສຳຄັນຂອງຊຸບ rpm ທັງໝົດ |
RPM -V package_name | ກວດກາຂະໜາດເອກະສານ, ອະນຸຍາດ, ແບບ, ເຈົ້າພາບ, ກຸ່ມ, MD5 ກວດກາ ແລະ ມີການແປງໃຫຍ່ສຸດຫຼ້ານີ້ |
RPM -Va | ກວດກາຊຸບ rpm ທີ່ຕິດຕັມໃນລະບົບ - ໃຊ້ກັບຄວາມລະມັດ |
Rpm -Vp package.rpm | ຢືນຢັນວ່າ rpm package ບໍ່ໄດ້ຕິດຕັມ |
Rpm2cpio package.rpm | cpio --extract --make-directories * bin * | ເຕີມເປີດຕາມ rpm package |
Rpm -ivh /usr/src/redhat/RPMS/arch/package.rpm | ຕິດຕັມ package RPM ຈາກ rpm source |
RPMbuild --rebuild package_name src.rpm | ສ້າງ RPM package ຈາກ RPM source |
code command | ຄຳສັ່ງ comment description |
---|---|
Yum install package_name | ດາວນຳລົງໄປແລະຕິດຕັມ RPM package |
Yum localinstall package_name | ການຕິດຕັມຊຸບປະກອບ rpm ຈະຖືກຕິດຕັມຈາກການສຳລັບຊຸບຫຼັກທີ່ເຈົ້າມີໄດ້ເພື່ອແກ້ໄຂຂໍ້ພິຈາລະນາຂອງທັງໝົດ |
Yum update package_name | Update all installed rpm packages in the current system |
Yum update package_name | Update an rpm package |
Yum remove package_name | Delete an RPM package |
Yum list | List all packages installed in the current system |
Yum search package_name | Search for packages in the rpm repository |
Yum cleaning packages | Clean the rpm cache and delete downloaded packages |
Yum cleaning headers | Delete all header files |
Yum clean all | Delete all cached packages and header files |
code command | ຄຳສັ່ງ comment description |
---|---|
Dpkg -i package.deb | Install/update a deb package |
Dpkg -r package_name | Delete a deb package from the system |
Dpkg -l | Display all installed deb packages in the system |
Dpkg -l | grep htpd | Display all deb packages with the word "htpd" in their name |
Dpkg -s package_name | Obtain information about a special package that has been installed in the system |
DPKG -L package_name | Displays a list of files provided by a deb package already installed on the system |
Dpkg --contents package.deb | Displays a list of files provided by a package that has not yet been installed |
DPKG -S /bin/ping | Verify which deb package provided the given file |
code command | ຄຳສັ່ງ comment description |
---|---|
Apt-get install package_name | Install/update a deb package |
Apt-cdrom install package_name | Install/update a deb package from CD |
Apt-get update | Upgrade packages in the list |
Apt-get upgrade | Upgrade all installed software |
Apt-get remove package_name | Delete a deb package from the system |
Apt-get check | Verify that the dependent software repository is correct |
Apt get clean | ການກວດສອບການກັກຂໍ້ມູນຈາກເອກະສານດາວທີ່ດາວໄດ້ດາວໄດ້ດາວໄດ້ດາວໄດ້ດາວໄດ້ |
Apt-cache search searched-package | ກຳລັງມູນຄ່າຊື່ບ່ອນການຄົ້ນຫາ |
code command | ຄຳສັ່ງ comment description |
---|---|
Cat file1 | ກວດຂັ້ນເນັດຂອງຂໍ້ມູນເອກະສານຈາກວັກສະຫຼັດທຳອິດ |
Tac file1 | ກວດຂັ້ນເນັດຂອງເອກະສານຄືນຈາກວັກສະຫຼັດສຸດທ້າຍ |
ຫຼາຍເອກະສານ1 | ກວດຂັ້ນເນັດຂອງເອກະສານທີ່ຍາວ |
ຫຼາຍເອກະສານ1 | ຄືກັບຄຳສັ່ງ 'more' ແຕ່ກໍ່ອາດດຳເນີນການກັບຄືນໃນເອກະສານຄືກັບການດຳເນີນການໄປໜ້າ |
ຫົວ -2 file1 | ກວດສະຫຼຸບວັກສະຫຼັດທີ່ສອງຫຼັງຂອງເອກະສານ |
Tail -2 file1 | Examine the last two lines of a file |
Tail -f /var/log/messages |
code command | ຄຳສັ່ງ comment description |
---|---|
Cat file1 | command (sed, grep, awk, grep, etc...) > result.txt | ຄູ່ນຂໍ້ມູນພະຍານຂອງເອກະສານແລະຂຽນສົນທະນາເຜີຍເພີ່ມໃຫ້ເອກະສານໃໝ່ |
Cat file1 | command (sed, grep, awk, grep, etc...) > > result.txt | ຄູ່ນຂໍ້ມູນພະຍານຂອງເອກະສານແລະຂຽນສົນທະນາເຜີຍເພີ່ມໃຫ້ເອກະສານທີ່ມີຢູ່ |
Grep Aug /var/log/messages | ຊອກຫາຄຳສັບ "Aug" ໃນເອກະສານ '/var/log/messages' |
Grep ^ Aug /var/log/messages | ຊອກຫາຄຳສັບທີ່ເລີ່ມຈາກ "Aug" ໃນເອກະສານ '/var/log/messages' |
Grep [0-9] /var/log/messages | ກວດສາຍທີ່ມີຈຳນວນຕາຍໃນ '/var/log/messages' file |
Grep Aug -R /var/log/* | ຊອກຫາຄຳສັບ "Aug" ໃນວຽງຊັ້ນ '/var/log' ແລະວຽງຊັ້ນຫຼັງຈາກນັ້ນ |
Sed's/stringa1/stringa2/g'example.txt | ປ່ຽນ "string1" ໃນເອກະສານ example.txt ທີ່ມີ "string2" |
Sed '/^ $/d' example.txt | ລົບວຽງຊັ້ນທີ່ຫຼາຍດ້ວຍສາຍນ້ຳຈາກເອກະສານ example.txt |
Se d '/ *#/ d;/^ $/d'example.txt from example.txt | ລົບການສົນທະນາຫຼືວຽງຊັ້ນທີ່ຫຼາຍດ້ວຍສາຍນ້ຳຈາກເອກະສານ |
Echo'esempio '| tr' [: lower :]' '[: upper:] ' | ຄູ່ນຂໍ້ມູນຂອງວຽງຊັ້ນຂອງວຽງຊັ້ນທີ່ສູງສຸດ |
Sed -e '1d' result.txt | ລົບວຽງຊັ້ນທຳອິດຈາກເອກະສານ example.txt |
Sed -n '/stringa1/p' | ກວດສາຍທີ່ມີຄຳສັບ "string1" |
Sed -e's / *$//' example.txt | ລົບສາຍນ້ຳທີ່ຢູ່ທີ່ທ້າຍວຽງຊັ້ນແຕ່ລະການລຸ່ມ |
Sed -e's/stringa1/g'example.txt | ລົບຄຳສັບ "string1" ຈາກເອກະສານແລະກັບຂໍ້ມູນທີ່ພຽງພໍ |
Sed -n '1,5p; 5q' example.txt | ກວດສານຂໍ້ມູນຈາກວຽງຊັ້ນທຳອິດຫາວຽງຊັ້ນທີ່ຫ້າ |
Sed -n '5p; 5q' example.txt | ກວດສາຍ 5 |
Sed -e's/00 */0/g'example.txt | ປ່ຽນຈຳນວນທັງໝົດຈຳນວນທີ່ເປັນສອງເທົ່າເປັນຈຳນວນທີ່ໜຶ່ງ |
Cat -n file1 | ກວດສອງວຽງສາຍທີ່ມີຈຳນວນຕາຍໃນເອກະສານ |
Cat example.txt | awk'NR% 2 == 1 ' | ລົບການລຸ່ມວຽງຊັ້ນທັງໝົດທີ່ເປັນຈຳນວນສອງ-ສະເພາະວຽງຊັ້ນທີ່ມີຈຳນວນຕາຍໃນເອກະສານ example.txt |
ສົ່ງອອກ a b c | awk '{print 1 ໂດລາ} | |
ສົ່ງອອກ a b c | awk '{print 1 ໂດລາ, 3 ໂດລາ} | ກວດສອງວຽງສາຍຂອງການລຸ່ມ |
ກັບຄືນເອກະສານ1 file2 | ຄູ່ນຂໍ້ມູນຂອງສາຍເອກະສານສອງເອກະສານຫຼືວຽງຊັ້ນ |
ກັບຄືນ -d '+ເອກະສານ '1 file2 | ຄູ່ນຂໍ້ມູນຂອງສາຍເອກະສານສອງເອກະສານຫຼືວຽງຊັ້ນ, ທີ່ຫຼາຍດ້ວຍ "+" ທີ່ກາງ |
Sort file1 file2 | ຈັດການຂໍ້ມູນຂອງສາຍເອກະສານສອງເອກະສານ |
Sort file1 file2 | uniq | ຫຼດອອກການຄູ່ນຂອງສາຍເອກະສານສອງເອກະສານ (ພຽງແຕ່ການຄົ້ນພົບສະເພາະເອກະສານທີ່ລຽງຄູ່ນພຽງຫຼັງ) |
Sort file1 file2 | uniq -u | Delete the intersection, leaving other lines |
Sort file1 file2 | uniq -d | Remove the intersection of two files (leaving only files that exist in both files simultaneously) |
Comm -1 file1 file2 | Comparing the contents of two files removes only the content contained in'file1 ' |
Comm -2 file1 file2 | Comparing the contents of two files removes only the content contained in'file2 ' |
Comm -3 file1 file2 | Compare the contents of two files to delete only the parts common to both files |
code command | ຄຳສັ່ງ comment description |
---|---|
Dos2unix filedos.txt fileunix.txt | Convert a text file format from MSDOS to UNIX |
Unix2dos fileunix.txt filedos.txt | Convert a text file format from UNIX to MSDOS |
Recode.. HTML < page.txt > Page.html | Convert a text file to HTML. |
Recode -l | more | Show all allowed conversion formats |
code command | ຄຳສັ່ງ comment description |
---|---|
Badblocks -v /dev/hda1 | Check for bad magnets on disk hda1 |
FSCK /dev/hda1 | Repair/check the integrity of the Linux file system on the HDA1 disk |
Fsck.ext2 /dev/hda1 | Repair/check the integrity of the ext2 file system on the hda1 disk |
E2FSCK /dev/hda1 | Repair/check the integrity of the ext2 file system on the hda1 disk |
E2fsck -j /dev/hda1 | Repair/check the integrity of the ext3 file system on the hda1 disk |
Fsck.ext3 /dev/hda1 | Repair/check the integrity of the ext3 file system on the hda1 disk |
Fsck.vfat /dev/hda1 | Repair/check the integrity of the fat file system on the hda1 disk |
Fsck.msdos /dev/hda1 | Repair/check the integrity of the DOS file system on the HDA1 disk |
Dosfsck /dev/hda1 | Repair/check the integrity of the DOS file system on the HDA1 disk |
code command | ຄຳສັ່ງ comment description |
---|---|
MKFS /dev/hda1 | Create a file system in the HDA1 partition |
MKE2FS /dev/hda1 | Create a linux ext2 filesystem in the hda1 partition |
MKE2FS -J /dev/hda1 | Create a linux ext3 (journaling) filesystem in the hda1 partition |
MKFS -T vfat 32 -F /dev/hda1 | Create a FAT32 file system |
Fdformat -n /dev/fd0 | Format a floppy disk |
MKSwap /dev/hda3 | Create a swap file system |
code command | ຄຳສັ່ງ comment description |
---|---|
MKSwap /dev/hda3 | Create a swap file system |
Swapon /dev/hda3 | Enable a new swap file system |
Swapon /dev/hda2 /dev/hdb3 | Enable two swap partitions |
code command | ຄຳສັ່ງ comment description |
---|---|
ຖືກກະກຽມຄືນ -0aj -f /tmp/home0.bak /home | Make a complete backup of the '/home' directory |
ຖືກກະກຽມຄືນ -1aj -f /tmp/home0.bak /home | ຖືກກະກຽມຄືນບໍລິການຫຼັງສັດຂອງ '/home' directory |
ຖືກກະກຽມຄືນ -if /tmp/home0.bak | ຖືກກະກຽມຄືນບໍລິການສຳລັບຫຼັງສັດ |
Rsync -rogpav --delete /home /tmp | ພັດທະນາສາຍຖານທາງສອງຝ່າຍ |
Rsync -rogpav -e ssh --delete /home ip_address:/tmp | ພາຍການສາຍ SSH rsync |
Rsync -az -e ssh --delete ip_addr:/home/public /home/local | ພັດທະນາສາຍຖານທາງໄກໄປຫາສາຍຖານທ້ອງຖິ່ນຫຼັງການເຊື່ອມຕໍ່ SSH ແລະ ການກັນພາບ |
Rsync -az -e ssh --delete /home/local ip_addr:/home/public | ພັດທະນາສາຍຖານທ້ອງຖິ່ນໄປຫາສາຍຖານທາງໄກຫຼັງການເຊື່ອມຕໍ່ SSH ແລະ ການກັນພາບ |
Dd bs = 1M if =/dev/hda | gzip | ssh user@ip _addr 'dd of = hda.gz' | ສາຍຄືນບໍລິການຫຼັງສັດໃນເຄື່ອງພັດທະນາການທາງໄກຫຼັງການເຊື່ອມຕໍ່ SSH |
Dd if =/dev/sda of =/tmp/file1 | Backup disk contents to a file |
Tar -Puf backup.tar /home/user | Perform an interactive backup of the '/home/user' directory |
(Cd /tmp/local/& tar c . ) | ssh -C user@ip _addr 'cd /home/share/& & tar x -p' | Copy the contents of a directory in a remote directory via ssh |
(Tar c /home) | ssh -C user@ip _addr 'cd /home/backup-home & & tar x -p' | Copy a local directory in a remote directory via ssh |
Tar cf - . | ( cd /tmp/backup; tar xf -) | Copy a directory locally to another place, retaining the original permissions and links |
ການຄົ້ນຫາ /home/user1 -name '* .txt' | xargs cp -av --target-directory =/home/backup/--parents | ການຄົ້ນຫາ ແລະ ສຳຫຼວດບັນນາທິການທີ່ສິ້ນສຸດດ້ວຍ '.txt' ຈາກສາຍລະຫວ່າງວັດສະວັດ |
ການຄົ້ນຫາ /var/log -name '* .log' | tar cv --files-from = - | bzip2 > log.tar.bz2 | ການຄົ້ນຫາບັນນາທິການທີ່ສິ້ນສຸດດ້ວຍ '.log' ແລະ ສ້າງກັບເປັນ bzip package |
Dd if =/dev/hda of =/dev/fd0 bs = 512 count = 1 | ການປະຕິບັດການເພື່ອສຳຫຼວດ MBR (Master Boot Record) content ໄປເຄື່ອງບັນທຶກ |
Dd if =/dev/fd0 of =/dev/hda bs = 512 count = 1 | ຟື້ນຂັງ MBR content ຈາກການບັນທຶກຂອງວັດສະວັດໃນວັດສະວັດເຄື່ອງບັນທຶກ |
code command | ຄຳສັ່ງ comment description |
---|---|
CDRecord -v gracetime = 2 dev =/dev/cdrom -eject blank = fast -force | ຖອນເນື້ອຫຼັງສາຍລະຫວ່າງວັດສະວັດທີ່ສາມາດຫຼັງຄືນໄດ້ |
Mkisofs /dev/cdrom > cd.iso | ສ້າງ ISO image ຂອງວັດສະວັດໃນວັດສະວັດ |
Mkisofs /dev/cdrom | gzip > cd_iso | ສ້າງຫຸ້ນສະແດງ ISO image file ຂອງວັດສະວັດໃນວັດສະວັດ |
MKISOFS -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o./cd.iso data_cd | ສ້າງ ISO image ຂອງສາຍລະຫວ່າງວັດສະວັດ |
Cdrecord -v dev =/dev/cdrom cd.iso | ບັນທຶກຫຸ້ນສະແດງ ISO image file |
Gzip -dc cd_iso | cdrecord dev =/dev/cdrom - | ບັນທຶກຫຸ້ນສະແດງ ISO image file |
ການຫວນ -o loop cd.iso /mnt/iso | ຈັດການຫຸ້ນສະແດງ ISO |
cd-paranoia -B | ການຂຽນການສະແດງສັນຍານດາວນິວາທິບານຈາກ CD ໄປເວັບຫຼັກຂໍ້ມູນ wav |
CD-paranoia -- "-3" | ການຂຽນການສະແດງສັນຍານດາວນິວາທິບານຈາກ CD ໄປເວັບຫຼັກຂໍ້ມູນ wav (ຄຳສັ່ງ) -3) |
CDRecord --scanbus | ສຳຫຼວດ bus ເພື່ອກວດສອບ channel scsi |
Dd if =/dev/hdc | md5sum | ການກວດສອບ MD5ການສະນັບການວັດສະວັດຂອງຄະນະພາບ, ອີງຕາມ CD |
code command | ຄຳສັ່ງ comment description |
---|---|
Dhclient eth01 | ເປີດຄະນະພາບນະຫຼາດ 'eth0' ໃນລະດັບ dhcp |
Ethtool eth01 | ສະແດງສະຖິຕິການສັນຍານຂອງບາງຄະນະກອງຫຸ້ນນະຫຼາດ 'eth0' |
ທໍລະນີ www.example.com | ຊອກຫາຊື່ຫວນ ເພື່ອຫາຄວາມສຳນຶກຊື່ ແລະ ທີ່ໂດຍສາຍລະບົບເຄືອຂ່າຍ ແລະ ສະແດງຫລອກ |
ຊື່ຄອນເຊັນ | ສະແດງຊື່ຄອນເຊັນ |
Ifconfig eth0 | ສະແດງການຈັດການບາງຄະນະກອງຫຸ້ນນະຫຼາດເອເທນ |
Ifconfig eth0 192.168.1.1 netmask 255.255.255.0 | Control Internet Protocol Addresses |
Ifconfig eth0 promisc | Set'eth0 'to promiscuous mode to sniff data packets |
Ifdown eth01 | Disable an'eth0 'network device |
Ifup eth01 | Enable an'eth0 'network device |
IP link show | Display the connection status of all network devices |
Iwconfig eth1 | ສະແດງການຕັ້ງຄວາມສະຫ�າກຂອງບັນດາບັນດາການເຊື່ອມຕໍ່ສາຍລະບົບໄລຍະສາຍ |
IWList scan | ສະແດງສາຍລະບົບໄລຍະສາຍ |
mii-tool eth01 | ສະແດງສະຖານະການເຊື່ອມຕໍ່ຂອງ 'eth0' |
Netstat -Tup | ສະແດງທັງໝົດການເຊື່ອມຕໍ່ເຄືອຂ່າຍທີ່ກະຕຸ້ນ ແລະ PID ຂອງພວກມັນ |
Netstat -tup1 | ສະແດງທັງໝົດບໍລິການເຄືອຂ່າຍໃນລະບົບ ແລະ PID ຂອງພວກມັນ |
Netstat -rn | ສະແດງການຄວງສາຍລະບົບ ຄ້າຍຄືກັບ "route -n" command |
Nslookup www.example.com | ຊອກຫາຊື່ຫວນ ເພື່ອຫາຄວາມສຳນຶກຊື່ ແລະ ທີ່ໂດຍສາຍລະບົບເຄືອຂ່າຍ ແລະ ສະແດງຫລອກ |
Route -n | ສະແດງການຄວງສາຍລະບົບ |
Route added -net 0/0 gw IP Gateway | ການຄວງການຕັ້ງຄວາມສະຖານທີ່ການຕັ້ງຄວາມສະຖານທີ່ການຕັ້ງຄວາມສະຖານທີ່ |
Route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.1.1 | ການຄວງການສັນຍານສະຖານທີ່ຫາສາຍລະບົບ192.168.0.0/16 ' |
Route del 0/0 gw IP gateway | ລຶບກົດລະບຽບສັນຍານສະຖານ |
Echo "1" > /proc/sys/net/ipv4/ip_foward | ກະຕຸ້ນການສົ່ງ IP |
Tcpdump tcp port 80 | ສະແດງທັງໝົດການຫລອກ HTTP |
Whois www.example.com | ການຄົ້ນຫາໃນຖານຂໍ້ມູນ Whois |
code command | ຄຳສັ່ງ comment description |
---|---|
ການຫວນ -t smbfs -o Username = user, password = pass //WinClient/share/mnt/share | ການຫວນສາຍລະບົບ Windows |
Nbtscan ip addr | ການຫາຄວາມສຳນຶກຊື່ Netbios |
Nmblookup -A ip addr | ການຫາຄວາມສຳນຶກຊື່ Netbios |
smbclient -L ip addr/hostname | ສະແດງການເຊື່ອມຕໍ່ຫ້ອງແຫ່ງຂອງສາຍລະບົບ Windows |
smbget -Rr smb://ip addr/share | ຄວາມສາມາດດາວໂຫລດບັນດາເອກະສານຈາກສາຍລະບົບ windows ຜ່ານ smb ເຊັ່ນ wget |
code command | ຄຳສັ່ງ comment description |
---|---|
Iptables -t filter -L | ສະແດງທັງໝົດການເຊື່ອມຕໍ່ໄປຫາການຕັ້ງຄວາມສະຫ�າກ filter |
Iptables -t nae -L | ສະແດງທັງໝົດການເຊື່ອມຕໍ່ໄປຫາການຕັ້ງຄວາມສະຫຼາກ NAT |
Iptables -t filter -F | ລຶບກົດລະບຽບທັງໝົດອີງຕາມການຕັ້ງຄວາມສະຫ�າກ filter |
Iptables -t nat -F | ລຶບກົດລະບຽບທັງໝົດອີງຕາມການຕັ້ງຄວາມສະຫຼາກ nat |
Iptables -t filter -X | ລຶບຜູ້ນຳໃຊ້ທັງໝົດ-ການສ້າງການເຊື່ອມຕໍ່ |
IPTables -t filter -A INPUT -p tcp --dport telnet -j ACCEPT | ອະນຸຍາດການເຂົ້າເຖິງ telnet |
IPTables -t filter -A OUTPUT -p tcp --dport telnet -j DROP | ກີດກັນການເຂົ້າເຖິງ telnet |
Iptables -t filter -A FORWARD -p tcp --dport pop3 -j ACCEPT | ອະນຸຍາດ POP3 ການເຊື່ອມຕໍ່ໃນການສົ່ງຂໍ້ມູນ |
Iptables -t filter -A INPUT -j LOG --log-ການຕັ້ງຄວາມສະຫຼາກ | ບັນທຶກພັດສະນະຖານຂອງການຈັບກວດສອງສາຍທັງໝົດ |
Iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | Set up a PAT (Port Address Translation) to mask outgoing packets in eth0 |
Iptables -t nat -A POSTROUTING -d 192.168.0.1 -p tcp -m tcp --dport 22-j DNAT --to-destination 10.0.0.2:22 | Forward packets destined for one host address to another host |
code command | ຄຳສັ່ງ comment description |
---|---|
Free -m | List RAM status in megabytes |
Kill -9 process id | Forcibly close the process and end it |
Kill -1 process id | Force a process to overload its configuration |
Last reboot | Show restart history |
lsmod | kernel module for listing states |
Lsof -p process id | List of files opened by the process |
LSOF /home/user1 | List of open files in the given system path |
PS -eafw | List linux tasks |
Ps -e -o pid, args --forest | List Linux tasks in a hierarchical manner |
PSTRESS | Display the program as a tree diagram |
SmartCTL -A /dev/hda | Monitor the reliability of hard disk devices by enabling SMART |
SmartCTL -I /dev/hda | Check if SMART is enabled for a hard disk device |
Strace -c ls >/dev/null | List system calls made and receive with one process |
Strace -f -e open ls >/dev/null | list library call |
Tail /var/log/dmesg | Display internal events during kernel boot |
Tail /val/log/messages | Display system events |
top | List the Linux tasks that use the most CPU resources |
Watch -nl'cat /proc/interrupts ' | List real time interrupts |
code command | ຄຳສັ່ງ comment description |
---|---|
Alias hh = 'history' | ການປ່ຽນອີກມາຄຳສັ່ງຫຼັງທາງ |
Apropos... ຄີໂອງ | ເຮັດລາຍການຄຳສັ່ງທີ່ບັນຈຸບາງສາຍຄີໂອງ, ສຳລັບການນຳໃຊ້ຫຼາຍສຸດເມື່ອເຈົ້າພຽງແຕ່ຮູ້ວ່າໂປຣກກຳລັງດຳເນີນເຫດການແຕ່ບໍ່ຮູ້ຄຳສັ່ງ |
CHSH | ປ່ຽນຄຳສັ່ງ shell |
CHSH --list-shells | ຄຳສັ່ງທີ່ດີສຳລັບການຊອກຫາວ່າເຈົ້າຕ້ອງເຊື່ອມຕໍ່ຄັນເຄື່ອງອີກຄັນຈາກໄລຍະຫ່າງ |
GPG -C filel | ຫຼົກຫຼັງເອກະສານດ້ວຍ GNU Privacy Guard |
Gpg filel.gpg | ຫຼົກຫຼັງເອກະສານດ້ວຍ GNU Privacy Guard |