وبلاگ رسانگار
با ما حرفه ای باشید

سرور مجازی NVMe

آموزش AتاZ دستوارت لینوکس،135 دستور به ترتیب اهمیت ، برگه تقلب

آشنایی با 135 دستور پرکاربرد و اصلی لینوکس بصورت خلاصه و مفید بصورت Cheat Sheet

0 7,904
100%
  • کیفیت نگارش
  • روانی نگارش
  • مفید بودن مطلب

سرفصلهای مطلب

زمان لازم برای مطالعه: 20 دقیقه

سلام ، خیلی وقت بود قصد داشتم چند پست یا پستی شبیه به این رو جمع آوری و ترجمه کنم و در بلاگ رسانگار برای شما منتشر کنم ، اما همیشه به دلیل اینکه جزئیات دستورات رو در مطالب وبلاگ نداشتیم اون رو به تعویق مینداختم !
امروز اما تصمیم گرفتم حداقل پست اصلی اون رو درست کنم و به تدریج راهنمای دستورات را هم آپدیت و لینک بدهیم
این پست به تدریج ترجمه و تکمیل میشه.

تعداد بیشماری دستورات در لینوکس وجود داره که ، معمولا بصورت روزانه به تعدادی از اونها وابسته هستیم و میشه گفت کسی که با لینوکس کار میکنه عملا این دستورات رو باید به خوبی و یا در حد پایه بشناسه ،

البته بعضی از دستورات  مختص توزیع خاصی از لینوکس هستند و اونها رو فقط میشه در یک یا چند نسخه خاص استفاده کرد و تعدادی از اونها هم هستند که میشه گفت در همه توزیع ها وجود دارند.

در این مقاله سعی داریم به لیستی از پرکاربردترین اونها اشاره کنیم و نمونه ها و راهنمایی کلی برای استفاده از اونها رو برای یادگیری آسان دستورات لینوکس ذکر کنیم.

نکته اصلی آموزش دستورات لینوکس
هر دستور رو با اضافه کردن man به ابتدای اون دستور برای راهنمای کامل و اصلی یا اضافه کردن –help به انتهای اون دستور برای سویچ های پرکاربرد و راهنمای خلاصه مشاهده کنید

مثلا:

$ man command-name
$ man screen

دستور adduser/addgroup

دستورات فوق همانطور که از نامشان پیداست برای اضافه کردن کاربر و گروه کاربری به سیستم استفاده می شوند.تنظیمات پیشفرض در فایل /etc/adduser.conf تعیین شده است

اگر با کاربر root وارد سیستم شده اید معمولا نیازی به SUDO در ابتدای دستور ندارید ، اما در صورتی که با کاربری غیر از root بصورت پیشفرض وارد شده اید ( بسیاری از توزیع های مبتنی بر دبیان مانند اوبونتو ) sudo برای اجرای دستورات سیستمی و اصلی نیاز خواهد بود

$ sudo adduser rasanegar

برای آشنایی با تعداد بیشتری از دستورات فوق 15 دستور کاربردی adduser در  Linux  را مطالعه کنید

agetty دستور

agetty دستوری است که ترمینال های فیزیکی و مجازی را مدیریت میکند و به وسیله init فراخوانی می شود ، به محض اینکه یک اتصال را شناسایی می کند یک پورت tty برای درخواست باز می‎کند و از کاربر user login را خواسته و /bin/login را فراخوانی میکند ، agetty یک دستور مشتق از getty لینوکس است.

$ agetty -L 9600 ttyS1 vt100

دستور alias

یکی از دستورات کاربردی و داخلی shell برای ایجاد alias ( معادل Shoutcut ) برای دستورات مختلف و طولانی تر لینوکسی است ، این دستور کاربری برای ایجاد دستورات جدید یا سفارشی  معادل دستورات اصلی قبلی  shell/linux + سویچ ها و آپشن های آنها است

$ alias home='cd /home/rasanegar/public_html'

دستور فوق یک دستور جدید به اسم home برای دستور طولانی cd /home/rasanegar/public_html’  ایجاد میکند ف بنابراین هر وقت شما home تایپ کنید مستقیما به مسیر خانه نام کاربری خود یا روت وب سایت خود هدایت می‎شوید

دستور anacron

anacron یک دسته  بندی (facility) در لینوکس است که برای اجرای دوره ای دستورات با بازه های زمانی روز ، هفته و ماه است

بر خلاف دستور خواهرش cron این دستور فرض را بر این میگذارد که سیستم بصورت مداوم روشن نیست ، بنابراین اگر دستوری در زمانی که سیستم خاموش بوده برای اجرا زمان بندی شده باشد ، به محض روشن شدن سیستم آن را اجرا می‎کند ، برای اینکه بیشتر درباره anacron و cron بدانید پست زیر را مطالعه کنید

Cron Vs Anacron: How to Schedule Jobs Using Anacron on Linux

دستور apropos

دستور فوق برای جستجو و نمایش توضیحاتی خلاصه از دستور man و پیدا کردن مشابه آن و مکان آن دستور که بالاتر توضیح داده شد می باشد که به شکل زیر استفاده می شود

$ apropos adduser

دستور apt

دستور apt سیستم مدیریت بسته های نصبی نسبتا جدید برای توزیع های دبیان/اوبونتو می باشد

$ sudo apt update

برای اطلاعات بیشتر این مطلب را مطالعه کنید: 15 Useful Examples on APT Command

دستور apt-get

apt-get یک سیستم مدیریت بسته های نصبی رایگان سمت کاربر است که برای توزیع های اوبونتو و دبیان طراحی شده است ، این ابرزار برای نصب بسته های نرم افزاری جدید یا حذف بسته های نرم افزاری قبلی نصد شده می باشد ، همجنین از این دستور برای بروزرسانی ( آپگرید ) نرم افزارهای اوبونتو و دبیان و همچنین کل سیستم عامل ( کرنل و پکیجهای اصلی ) استفاده می شود

$ sudo apt-get update

برای اطلاعات بیشتر این مطلب را مطالعه کنید: 25 Useful Commands of APT-GET for Package Management

دستور aptitude

دستور فوق که نام با مسمایی هم دارد یک  رابط کاربری متنی برای سیستم مدیریت بسته های نسبی دبیان است ، مانند apt و apt-get این دستور می باشد برای نصب ، حذف و یا ارتقا بسته های نرم افزاری روی سیستم مورد استفاده قرار بگیرد.

$ sudo aptitude update

برای اطلاعات بیشتر این مطلب را مطالعه کنید: Learn Debian Package Management with Aptitude Command

دستور arch

arch یک دستور ساده برای نمایش معماری ماشین و نام سخت افزاری است ،  ( مشابه uname -m )

$ arch 

دستور arp

ARP (Address Resolution Protocol) یک پرتوکل است که آدرس IP شبکه را با آدرس سخت افزاری سیستمهای همسایه آدرس دهی میکند ، این دستور در شبکه های IPv4 کاربرد دارد

با دستور زیر میتوانید همه دستگاه های موجود در شبکه ای که روی کارت شبکه enp2s0 دیده می شود لیست کنید

$ sudo arp-scan --interface=enp2s0 --localnet  

دستور at

دستور at برای زمانبندی اجرای برنامه ها و وظایف در آینده استفاده می شود ، این دستور مشابه cron , anacron است ، اگرچه فقط دستور ( تسک ) داده شده را فقط یک بار در آینده بدون نیاز به ویرایش هیچ فایل کانفیگی اجرا می کند.

مثلا دستور زیر سیستم را در ساعت 23:55 روز جاری خاموش خواهد کرد.

$ sudo echo "shutdown -h now" | at -m 23:55

دستور atq

atq برای مشاهده لیست کارهای زمانبندی شده با دستور at استفاده قرار میگیرد ( at queue ):

$ atq

دستور atrm

این دستور نیز تکمیل کننده at می باشد که برای حذف کارهای ایجاد شده استفاده می شود ( برای این کار ID آن job نیاز است )

$ atrm 2

برای توضیحات بیشتر این پست را بخوانید : How to Use ‘at’ Command to Schedule a Task in Linux

دستور awk

Awk یک زبان برنامه نویسی بسیار قدرتمند است که برای پردازش متن ایجاد شده ، از این دستور عموما به عنوان استخراج محتوا و ابزار گزارش گیری استفاده می شود

$ awk '//{print}'/etc/hosts

برای درک مفاهیم awk در لینوکس ( پایه ای و پیشرفته ) بزودی کتابی در وبلاگ قرار خواهیم داد

دستور batch

batch هم مانند دستور  at در لینوکس دستوری برای اجرای دستورات دیگری در آینده است .

دستور basename

دستور basename به شما کمک خواهد کرد تا نام یک فایل را با حذف دایرکتوری(های) مسیر قرار گیری آن فایل مشاهده کنید. از این دستور معمولا در برنامه نویسی مثلا bash scripting استفاده می شود

$ basename bin/findhosts.sh

دستور bc

bc دستور هم یک دستور ساده در عین حال قدرتمند برای محاسبات دقیق در محیط خط فرمان است که میتوانند مانند زیر مورد استفاده قرار گیرد.

$ echo 20.05 + 15.00 | bc

دستور bg

bg دستوری است که برای فرستادن دستور و پردازه دیگر به پس زیمنه برای اجرا استفاده می شود .

$ tar -czf home.tar.gz .
$ bg 
$ jobs

برای توضیحات بیشتر این پست را بخوانید Start Linux Command in Background and Detach Process in Terminal

bzip2 دستور

bzip2 دستوری برای فشرده سازی / استخراج فایلها می باشد

$ bzip2 -z filename      #Compress
$ bzip2 -d filename.bz2  #Decompress

برای توضیحات بیشتر این پست را بخوانید: How to Compress and Decompress a .bz2 File in Linux

دستور cal

دستوری برای نمایش یک تقویم میلادی به شکل استاندارد.

$ cal

دستور cat

دستور cat که یکی از دستورات شناخته شده و پرکاربرد است ، برای مشاهده محتویات یک فایل یا ادغام کردن فایلها و یا نمایش داده های استاندارد ورودی و نمایش به شکل استاندارد خروجی می باشد

$ cat file.txt

برای توضیحات بیشتر در خصوص دستور cat این لینک را مطالعه کنید : 13 Useful Cat Command Examples on Linux

دستور chgrp

دستوری است که برای تغییر گروه عضویت روی دسترسی های فایل می باشد ، گروه جدید را به عنوان اولین آرگومان گرفته و آرگومان دوم ورودی هم نام فایل مورد نظر می باشد

$ chgrp rasanegar users.txt

دستور chmod

chmod command is used to change/update file access permissions like this.

$ chmod +x sysinfo.sh

دستور chown

chown برای تغییر یا بروزرسانی نام کاربری و گروه مالکیت فایل/دایرکتوری مورد استفاده قرار می‎گیرد

$ chmod -R www-data:www-data /var/www/html

برای یادگیری روش استفاده از دستورات chmod , chown این مطلب را مطالعه کنید :

Managing Users & Groups, File Permissions & Attributes in Linux

دستور cksum

cksum برای نمایش خروجی CRC و شمارش بایت فایل ورودی مورد استفاده قرار میگیرد ، از این ابزار معمولا برای تائید اصالت و سلامت فایلهای دریافت شده از طریق ابزاریهایی مانند wget , curl با مقایسه خروجی CRC با فایل مبدا استفاده می شود

$ cksum README.txt

دستور clear

دستوری ساده ! اما کاربردی در محیطهای شلوغ ! برای پاک کردن ترمینال خود فقط تایپ کنید ، ( منظور از پاک کردن خالی کردن صفحه نمایش است و واقعا فایلی یا سابقه دستورات و خروجی آنها پاک نمی شود )

$ clear

دستور cmp

دستور cmp یک مقایسه بایت به بایت دو فایل ورودی را انجام میدهد ،

$ cmp file1 file2

دستور comm

comm برای مقایسه دو فایل متنی مرتب شده بصورت خط به خط با شکل استفاده زیر به کار می رود

$ comm file1 file2

دستور cp

cp یک دستور کاربردی برای کپی کردن و فایل و دایکتوری ها از یک مسیر مبدا روی مسیر دیگر می‎باشد .

$ cp /home/tecmint/file1 /home/tecmint/Personal/

برای اطلاعات بیشتر در خصوص کپی کردن فایلها در لینوکس که گاها میتواند بحثی چالشی باشد مطالب زیر را مطالعه کنید .

پیشنهاد می‌کنیم بخوانید:  CentOS یا Ubuntu: کدام لینوکس گزینه بهتری برای سرور است؟

How to Copy a File to Multiple Directories in Linux

Advanced Copy Command – Shows Progress Bar While Copying Large Files/Folders in Linux

Progress – A Tiny Tool to Monitor Progress for (cp, mv, dd, tar, etc.) Commands in Linux

دستور date

date برای نمایش یا تنظیم ساعت سیسم مطابق فرمت زیر مورد استفاده قرار می‎گیرد.

$ date
$ date --set="8 JUN 2017 13:00:00"

To learn more about how to set date in Linux, read: How to Set System Date in Linux

دستور dd

dd برای کپی، تبدیل و تغییر فرمت بر اساس سویچ های مورد استفاده در دستور استفاده می شود ، این دستور میتواند header فایلها را استخراج کند یا بخشی از فایل باینری را استخراج کند و یا موارد این چنینی دیگر….

دستور نمونه زیر ایجاد یک درایو USB بوتیبل مورد استفاده قرار میگیرد:

$ dd if=/home/rasanegar/kali-linux-1.0.4-i386.iso of=/dev/sdc1 bs=512M; sync

دستور df

ایت دستور برای نمایش مقدار استفاده شده از filesystem در مسیر فعلی مورد استفاده قرار میگیرد ، این دستور با سویچ های مرتبط آن میتواند در مدیریت فایلها بسیار مفید واقع شود

 

$ df -h

برای مشاهده موارد بیشتر مورد استفاده این پست را بخوانید : 12 Useful ‘df’ Command Examples to Check Disk Space

دستور diff

از این دستور برای مقایسه خط به خط دو فایل مورد استفاده قرار میگیرد ، همچنین از این دستور می توان برای پیدا کردن تفاوت های بین دو فایل مانند نمونه زیر استفاده می‎شود

 

$ diff file1 file2

برخی از وارد پرکاربرد استفاده این دستور در مقاله زیر آورده شده است

: 8 Best File Comparison and Difference (Diff) Tools for Linux

دستور dir

دستور dir در لینوکس مانند دستور ls کار می کند و لیست محتوای دایرکتوری فعلی را نمایش می‎دهد

$ dir

دستور dmidecode

dmidecode command is a tool for retrieving hardware information of any Linux system. It dumps a computer’s DMI (a.k.a SMBIOS) table contents in a human-readable format for easy retrieval.

To view your system hardware info, you can type:

$ sudo dmidecode --type system

Some useful tools to find out Linux system hardware info: 10 Useful Commands to Get Linux Hardware Information

دستور du

du command is used to show disk space usage of files present in a directory as well as its sub-directories as follows.

$ du /home/aaronkilik

دستور echo

echo command prints a text of line provided to it.

$ echo “This is TecMint - Linux How Tos”

دستور eject

eject command is used to eject removable media such as DVD/CD ROM or floppy disk from the system.

$ eject /dev/cdrom
$ eject /mnt/cdrom/
$ eject /dev/sda

env Command

env command lists all the current environment variables and used to set them as well.

$ env

Learn more on How to Set and Unset Environment Variables in Linux

exit Command

exit command is used to exit a shell like so.

$ exit

expr Command

expr command is used to calculate an expression as shown below.

$ expr 20 + 30

factor Command

factor command is used to show the prime factors of a number.

$ factor 10

find Command

find command lets you search for files in a directory as well as its sub-directories. It searches for files by attributes such as permissions, users, groups, file type, date, size and other possible criteria.

$ find /home/tecmint/ -name tecmint.txt

Learn more on how to find files in Linux:

  1. How to Use ‘find’ Command to Search for Multiple Filenames (Extensions)
  2. How to Find Number of Files in a Directory and Subdirectories
  3. How to Find Today’s Modified Files in Linux
  4. How to Find and Sort Files Based on Modified Date and Time
  5. How to Find Top Directories and Files (Disk Space) in Linux

free Command

free command shows the system memory usage (free, used, swapped, cached, etc.) in the system including swap space. Use the -h option to display output in human friendly format.

$ free -h 

Learn more on how to find memory usage in Linux.

  1. Find Top Running Processes by Highest Memory and CPU Usage in Linux
  2. Smem – Reports Memory Consumption Per-Process and Per-User Basis in Linux
  3. How to Clear RAM Memory Cache, Buffer and Swap Space on Linux

grep Command

grep command searches for a specified pattern in a file (or files) and displays in output lines containing that pattern as follows.

$ grep ‘tecmint’ domain-list.txt

Learn more about grep command usage in Linux.

  1. What’s Difference Between Grep, Egrep and Fgrep in Linux?
  2. 12 Basic Linux ‘Grep’ Command Examples in Linux
  3. 11 Advanced Linux ‘Grep’ Commands in Linux

groups Command

groups command displays all the names of groups a user is a part of like this.

$ groups
$ groups tecmint

gzip Command

Gzip helps to compress a file, replaces it with one having a .gz extension as shown below:

$ gzip passwds.txt
$ cat file1 file2 | gzip > foo.gz

gunzip Command

gunzip expands or restores files compressed with gzip command like this.

$ gunzip foo.gz

head command is used to show first lines (10 lines by default) of the specified file or stdin to the screen:

# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head 

history Command

history command is used to show previously used commands or to get info about command executed by a user.

$ history

Learn more about Linux history command.

  1. The Power of Linux “History Command” in Bash Shell
  2. Set Date and Time for Each Command You Execute in Bash History
  3. How to Use ‘Yum History’ to Find Out Installed/Removed Packages Info

hostname Command

hostname command is used to print or set system hostname in Linux.

$ hostname
$ hostname NEW_HOSTNAME

hostnamectl Command

hostnamectl command controls the system hostname under systemd. It is used to print or modify the system hostname and any related settings:

$ hostnamectl
$ sudo hostnamectl set-hostname NEW_HOSTNAME

hwclock

hwclock is a tool for managing the system hardware clock; read or set the hardware clock (RTC).

$ sudo hwclock
$ sudo hwclock --set --date 8/06/2017

hwinfo Command

hwinfo is used to probe for the hardware present in a Linux system like this.

$ hwinfo

Learn more about how to get Linux hardware info.

  1. I-Nex – An Advanced Tool to Collect System/Hardware Information in Linux
  2. 9 Useful Tools to Get System Information in Linux

id Command

id command shows user and group information for the current user or specified username as shown below.

$ id tecmint

ifconfig Command

ifconfig command is used to configure a Linux systems network interfaces. It is used to configure, view and control network interfaces.

$ ifconfig
$ sudo ifconfig eth0 up
$ sudo ifconfig eth0 down
$ sudo ifconfig eth0 172.16.25.125

ionice Command

ionice command is used to set or view process I/O scheduling class and priority of the specified process.

If invoked without any options, it will query the current I/O scheduling class and priority for that process:

$ ionice -c 3 rm /var/logs/syslog

To understand how it works, read this article: How to Delete HUGE (100-200GB) Files in Linux

iostat Command

iostat is used to show CPU and input/output statistics for devices and partitions. It produces useful reports for updating system configurations to help balance the input/output load between physical disks.

$ iostat 

ip Command

ip command is used to display or manage routing, devices, policy routing and tunnels. It also works as a replacement for well known ifconfig command.

This command will assign an IP address to a specific interface (eth1 in this case).

$ sudo ip addr add 192.168.56.10 dev eth1

iptables Command

iptables is a terminal based firewall for managing incoming and outgoing traffic via a set of configurable table rules.

The command below is used to check existing rules on a system (using it may require root privileges).

$ sudo iptables -L -n -v

Learn more about iptables firewall in Linux.

  1. How to Start/Stop and Enable/Disable FirewallD and Iptables in Linux
  2. Basic Guide on IPTables (Linux Firewall) Tips / Commands
  3. Nishita Agarwal Shares Her Interview Experience on Linux ‘iptables’ Firewall

iw Command

iw command is used to manage wireless devices and their configuration.

$ iw list 

iwlist Command

iwlist command displays detailed wireless information from a wireless interface. The command below enables you to get detailed information about the wlp1s0 interface.

$ iwlist wlp1s0 scanning

kill Command

kill command is used to kill a process using its PID by sending a signal to it (default signal for kill is TERM).

$ kill -p 2300
$ kill -SIGTERM -p 2300

killall Command

killall command is used to kill a process by its name.

$ killall firefox

Learn more about kill and killall command in Linux.

  1. How to Find and Kill Running Processes in Linux
  2. A Guide to Kill, Pkill and Killall Commands to Terminate a Process
  3. How to Kill Processes/Unresponsive Applications Using ‘xkill’ Command

kmod Command

kmod command is used to manage Linux kernel modules. To list all currently loaded modules, type.

$ kmod list

last Command

last command display a listing of last logged in users.

$ last 

ln Command

ln command is used to create a soft link between files using the -s flag like this.

$ ln -s /usr/bin/lscpu cpuinfo

locate Command

locate command is used to find a file by name. The locate utility works better and faster than it’s find counterpart.

The command below will search for a file by its exact name (not *name*):

$ locate -b '\domain-list.txt'

login Command

login command is used to create a new session with the system. You’ll be asked to provide a username and a password to login as below.

$ sudo login

ls Command

ls command is used to list contents of a directory. It works more or less like dir command.

The -l option enables long listing format like this.

$ ls -l file1

To know more about ls command, read our guides.

  1. 15 Basic ‘ls’ Command Examples in Linux
  2. 7 Quirky ‘ls’ Command Tricks Every Linux User Should Know
  3. How to Sort Output of ‘ls’ Command By Last Modified Date and Time
  4. 15 Interview Questions on Linux “ls” Command – Part 1
  5. 10 Useful ‘ls’ Command Interview Questions – Part 2

lshw Command

lshw command is a minimal tool to get detailed information on the hardware configuration of the machine, invoke it with superuser privileges to get a comprehensive information.

$ sudo lshw  

lscpu Command

lscpu command displays system’s CPU architecture information (such as number of CPUs, threads, cores, sockets, and more).

$ lscpu

lsof Command

lsof command displays information related to files opened by processes. Files can be of any type, including regular files, directories, block special files, character special files, executing text reference, libraries, and stream/network files.

To view files opened by a specific user’s processes, type the command below.

$ lsof -u tecmint

lsusb Command

lsusb command shows information about USB buses in the system and the devices connected to them like this.

$ lsusb 

man Command

man command is used to view the on-line reference manual pages for commands/programs like so.

$ man du
$ man df

md5sum Command

md5sum command is used to compute and print the MD5 message digest of a file. If run without arguments, debsums checks every file on your system against the stock md5sum files:

$ sudo debsums

mkdir Command

mkdir command is used to create single or more directories, if they do not already exist (this can be overridden with the -p option).

$ mkdir tecmint-files
OR 
$ mkdir -p tecmint-files

more Command

more command enables you to view through relatively lengthy text files one screenful at a time.

$ more file.txt

Check difference between more and less command and Learn Why ‘less’ is Faster Than ‘more’ Command

mv Command

mv command is used to rename files or directories. It also moves a file or directory to another location in the directory structure.

$ mv test.sh sysinfo.sh 

nano Command

nano is a popular small, free and friendly text editor for Linux; a clone of Pico, the default editor included in the non-free Pine package.

پیشنهاد می‌کنیم بخوانید:  Bash if... other statement

To open a file using nano, type:

$ nano file.txt

nc/netcat Command

nc (or netcat) is used for performing any operation relating to TCP, UDP, or UNIX-domain sockets. It can handle both IPv4 and IPv6 for opening TCP connections, sending UDP packets, listening on arbitrary TCP and UDP ports, performing port scanning.

The command below will help us see if the port 22 is open on the host 192.168.56.5.

$ nc -zv 192.168.1.5 22

Learn more examples and usage on nc command.

  1. How to Check Remote Ports are Reachable Using ‘nc’ Command
  2. How to Transfer Files Between Computers Using ‘nc’ Command

netstat Command

netstat command displays useful information concerning the Linux networking subsystem (network connections, routing tables, interface statistics, masquerade connections, and multicast memberships).

This command will display all open ports on the local system:

$ netstat -a | more

nice Command

nice command is used to show or change the nice value of a running program. It runs specified command with an adjusted niceness. When run without any command specified, it prints the current niceness.

The following command starts the process “tar command” setting the “nice” value to 12.

$ nice -12 tar -czf backup.tar.bz2 /home/*

nmap Command

nmap is a popular and powerful open source tool for network scanning and security auditing. It was intended to quickly scan large networks, but it also works fine against single hosts.

The command below will probe open ports on all live hosts on the specified network.

$ nmap -sV 192.168.56.0/24

nproc Command

nproc command shows the number of processing units present to the current process. It’s output may be less than the number of online processors on a system.

$ nproc  

openssl Command

The openssl is a command line tool for using the different cryptography operations of OpenSSL’s crypto library from the shell. The command below will create an archive of all files in the current directory and encrypt the contents of the archive file:

$ tar -czf - * | openssl enc -e -aes256 -out backup.tar.gz

passwd Command

passwd command is used to create/update passwords for user accounts, it can also change the account or associated password validity period. Note that normal system users may only change the password of their own account, while root may modify the password for any account.

$ passwd tecmint

pidof Command

pidof displays the process ID of a running program/command.

$ pidof init
$ pidof cinnamon

ping Command

ping command is used to determine connectivity between hosts on a network (or the Internet):

$ ping google.com

ps Command

ps shows useful information about active processes running on a system. The example below shows the top running processes by highest memory and CPU usage.

# ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head

pstree Command

pstree displays running processes as a tree which is rooted at either PID or init if PID is omitted.

$ pstree

pwd Command

pwd command displays the name of current/working directory as below.

$ pwd

rdiff-backup Command

rdiff-backup is a powerful local/remote incremental backup script written in Python. It works on any POSIX operating system such as Linux, Mac OS X.

Note that for remote backups, you must install the same version of rdiff-backup on both the local and remote machines. Below is an example of a local backup command:

$ sudo rdiff-backup /etc /media/tecmint/Backup/server_etc.backup

reboot Command

reboot command may be used to halt, power-off or reboot a system as follows.

$ reboot

rename Command

rename command is used to rename many files at once. If you’ve a collection of files with “.html” extension and you want to rename all of them with “.php” extension, you can type the command below.

$ rename 's/\.html$/\.php/' *.html

rm command

rm command is used to remove files or directories as shown below.

$ rm file1
$ rm -rf my-files

rmdir Command

rmdir command helps to delete/remove empty directories as follows.

$ rmdir /backup/all

scp Command

scp command enables you to securely copy files between hosts on a network, for example.

$ scp ~/names.txt root@192.168.56.10:/root/names.txt

shutdown Command

shutdown command schedules a time for the system to be powered down. It may be used to halt, power-off or reboot the machine like this.

$ shutdown --poweroff

Learn how to show a Custom Message to Users Before Linux Server Shutdown.

sleep Command

sleep command is used to delay or pause (specifically execution of a command) for a specified amount of time.

$ check.sh; sleep 5; sudo apt update

sort Command

sort command is used to sort lines of text in the specified file(s) or from stdin as shown below

$ cat words.txt

Learn more examples of sort command in Linux.

  1. 7 Interesting Linux ‘sort’ Command Examples
  2. How to Sort Output of ‘ls’ Command By Last Modified Date and Time
  3. How to Find and Sort Files Based on Modification Date and Time

split Command

split as the name suggests, is used to split a large file into small parts.

$ tar -cvjf backup.tar.bz2 /home/tecmint/Documents/* 

ssh Command

ssh (SSH client) is an application for remotely accessing and running commands on a remote machine. It is designed to offer a secure encrypted communications between two untrusted hosts over an insecure network such as the Internet.

$ ssh tecmint@192.168.56.10

Learn more about ssh command and how to use it on Linux.

  1. 5 Best Practices to Secure and Protect SSH Server
  2. Configure “No Password SSH Keys Authentication” with PuTTY on Linux
  3. SSH Passwordless Login Using SSH Keygen in 5 Easy Steps
  4. Restrict SSH User Access to Certain Directory Using Chrooted Jail

stat Command

stat is used to show a file or file system status like this (-f is used to specify a filesystem).

$ stat file1

su Command

su command is used to switch to another user ID or become root during a login session. Note that when su is invoked without a username, it defaults to becoming root.

$ su 
$ su tecmint

sudo Command

sudo command allows a permitted system user to run a command as root or another user, as defined by the security policy such as sudoers.

In this case, the real (not effective) user ID of the user running sudo is used to determine the user name with which to query the security policy.

$ sudo apt update
$ sudo useradd tecmint
$ sudo passwd tecmint

Learn more about sudo command and how to use it on Linux.

  1. 10 Useful Sudoers Configurations for Setting ‘sudo’ in Linux
  2. How to Run ‘sudo’ Command Without Entering a Password in Linux
  3. How to Keep ‘sudo’ Password Timeout Session Longer in Linux

sum Command

sum command is used to show the checksum and block counts for each each specified file on the command line.

$ sum output file.txt 

tac Command

tac command concatenates and displays files in reverse. It simply prints each file to standard output, showing last line first.

$tac file.txt

tail Command

tail command is used to display the last lines (10 lines by default) of each file to standard output.

If there more than one file, precede each with a header giving the file name. Use it as follow (specify more lines to display using -n option).

$ tail long-file
OR
$ tail -n 15 long-file

talk Command

talk command is used to talk to another system/network user. To talk to a user on the same machine, use their login name, however, to talk to a user on another machine use ‘user@host’.

$ talk person [ttyname]
OR
$ talk‘user@host’ [ttyname]

tar Command

tar command is a most powerful utility for archiving files in Linux.

$ tar -czf home.tar.gz .

Learn more about tar command and its usage on Linux.

  1. 18 Tar Command Examples in Linux
  2. How to Split Large ‘tar’ Archive into Multiple Files of Certain Size
  3. How to Extract Tar Files to Specific or Different Directory in Linux

tee Command

tee command is used to read from standard input and prints to standard output and files as shown below.

$ echo "Testing how tee command works" | tee file1 

time Command

time command runs programs and summarizes system resource usage.

$ time wc /etc/hosts

top Command

top program displays all processes on a Linux system in regards to memory and CPU usage and provides a dynamic real-time view of a running system.

$ top

touch Command

touch command changes file timestamps, it can also be used to create a file as follows.

$ touch file.txt

tr Command

tr command is a useful utility used to translate (change) or delete characters from stdin, and write the result to stdout or send to a file as follows.

$ cat domain-list.txt | tr [:lower:] [:upper:]

uname Command

uname command displays system information such as operating system, network node hostname kernel name, version and release etc.

Use the -a option to show all the system information:

$ uname 

uniq Command

uniq command displays or omits repeated lines from input (or standard input). To indicate the number of occurrences of a line, use the -c option.

$ cat domain-list.txt

uptime Command

uptime command shows how long the system has been running, number of logged on users and the system load averages as follows.

$ uptime

users Command

users command shows the user names of users currently logged in to the current host like this.

$ users

vim/vi Command

vim (Vi Improved) popular text editor on Unix-like operating systems. It can be used to edit all kinds of plain text and program files.

$ vim file

Learn how to use vi/vim editor in Linux along with some tips and tricks.

  1. 10 Reasons Why You Should Use Vi/Vim Editor in Linux
  2. How to Install and Use Vi/Vim Editor in Linux
  3. How to Save a File in Vim Editor in Linux
  4. How to Exit a File in Vim Editor in Linux
  5. Learn Useful ‘Vi/Vim’ Editor Tips and Tricks to Enhance Your Skills
  6. 8 Interesting ‘Vi/Vim’ Editor Tips and Tricks for Every Linux Administrator

w Command

w command displays system uptime, load averages and information about the users currently on the machine, and what they are doing (their processes) like this.

$ w

wall Command

wall command is used to send/display a message to all users on the system as follows.

$ wall “This is TecMint – Linux How Tos”

watch Command

watch command runs a program repeatedly while displaying its output on fullscreen. It can also be used to watch changes to a file/directory. The example below shows how to watch the contents of a directory change.

$ watch -d ls -l

wc Command

wc command is used to display newline, word, and byte counts for each file specified, and a total for many files.

$ wc filename

wget Command

wget command is a simple utility used to download files from the Web in a non-interactive (can work in the background) way.

$ wget -c http://ftp.gnu.org/gnu/wget/wget-1.5.3.tar.gz

whatis Command

whatis command searches and shows a short or one-line manual page descriptions of the provided command name(s) as follows.

$ whatis wget

which Command

which command displays the absolute path (pathnames) of the files (or possibly links) which would be executed in the current environment.

$ which who

who Command

who command shows information about users who are currently logged in like this.

$ who

whereis Command

whereis command helps us locate the binary, source and manual files for commands.

$ whereis cat

xargs Command

xargs command is a useful utility for reading items from the standard input, delimited by blanks (protected with double or single quotes or a backslash) or newlines, and executes the entered command.

The example below show xargs being used to copy a file to multiple directories in Linux.

$ echo /home/aaronkilik/test/ /home/aaronkilik/tmp | xargs -n 1 cp -v /home/aaronkilik/bin/sys_info.sh

yes Command

yes command is used to display a string repeatedly until when terminated or killed using [Ctrl + C] as follows.

$ yes "This is TecMint - Linux HowTos"

youtube-dl Command

youtube-dl is a lightweight command-line program to download videos and also extract MP3 tracks from YouTube.com and a few more sites.

The command below will list available formats for the video in the provided link.

$ youtube-dl --list-formats https://www.youtube.com/watch?v=iR

zcmp/zdiff Command

zcmp and zdiff minimal utilities used to compare compressed files as shown in the examples below.

$ zcmp domain-list.txt.zip basic_passwords.txt.zip
$ zdiff domain-list.txt.zip basic_passwords.txt.zip 

zip Command

zip is a simple and easy-to-use utility used to package and compress (archive) files.

$ tar cf - . | zip | dd of=/dev/nrst0 obs=16k
$ zip inarchive.zip foo.c bar.c --out outarchive.zip
$ tar cf - .| zip backup -

دستور zz

zz دستوری از نوع alias برای ابزارهای خط فرمان fasd است که دسترسی سریع به فایل ها و دایرکتوری ها در لینوکس را در اختیار شما قرار میدهد . این ابراز برای cd یا تغیر پوشه فعلی به پوشه قبلی که در آن بودید و به آن دسترسی پیدا  کردید انتخاب شماره دایرکتوری مطابق نمونه زیر  می باشد

$ zz

خوب تا الان ! موفق شدم این موارد رو اشاره کنم که همانطور که قبلا گفتم ،واقا تعداد غیر قابل شمارشی دستورات در لینوکس وجود دارد که لیست آن بسیار طولانی تر از آن است بتوانیم آن را فقط در یک پست قرار بدهیم ، از بخش ارسال دیدگاه زیر ما را از دستوراتی که ممکن است از قلم افتاده باشد مطلع کنید

 

4.3/5 (21 رای)
100%
  • کیفیت نگارش
  • روانی نگارش
  • مفید بودن مطلب
دیدگاه شما در خصوص مطلب چیست ؟

آدرس ایمیل شما منتشر نخواهد شد.

لطفا دیدگاه خود را با احترام به دیدگاه های دیگران و با توجه به محتوای مطلب درج کنید