Printing commands in linux

Содержание
  1. Printing commands in linux
  2. Печать из командной строки Linux
  3. Вывод параметров принтера
  4. Полезные команды
  5. Двусторонняя печать
  6. Печать в ландшафтном режиме
  7. Print from command line
  8. 8 Answers 8
  9. print command instead of echo in linux
  10. So is there any way to print a simple line using print alone instead of echo ?
  11. 2 Answers 2
  12. Example
  13. printf
  14. mailcap
  15. Example
  16. A – Z Linux Commands – Overview with Examples
  17. On this page
  18. adduser/addgroup Command
  19. agetty Command
  20. alias Command
  21. anacron Command
  22. apropos Command
  23. apt Command
  24. apt-get Command
  25. aptitude Command
  26. arch Command
  27. arp Command
  28. at Command
  29. atq Command
  30. atrm Command
  31. awk Command
  32. batch Command
  33. basename Command
  34. bc Command
  35. bg Command
  36. bzip2 Command
  37. cal Command
  38. cat Command
  39. chgrp Command
  40. chmod Command
  41. chown Command
  42. cksum Command
  43. clear Command
  44. cmp Command
  45. comm Command
  46. cp Command
  47. date Command
  48. dd Command
  49. df Command
  50. diff Command
  51. dir Command
  52. dmidecode Command
  53. du Command
  54. echo Command
  55. eject Command
  56. env Command
  57. exit Command
  58. expr Command
  59. factor Command
  60. find Command
  61. free Command
  62. grep Command
  63. groups Command
  64. gzip Command
  65. gunzip Command
  66. head Command
  67. history Command
  68. hostname Command
  69. hostnamectl Command
  70. hwclock
  71. hwinfo Command
  72. id Command
  73. ifconfig Command
  74. ionice Command
  75. iostat Command
  76. ip Command
  77. iptables Command
  78. iw Command
  79. iwlist Command
  80. kill Command
  81. killall Command
  82. kmod Command
  83. last Command
  84. ln Command
  85. locate Command
  86. login Command
  87. ls Command
  88. lshw Command
  89. lscpu Command
  90. lsof Command
  91. lsusb Command
  92. man Command
  93. md5sum Command
  94. mkdir Command
  95. more Command
  96. mv Command
  97. nano Command
  98. nc/netcat Command
  99. netstat Command
  100. nice Command
  101. nmap Command
  102. nproc Command
  103. openssl Command
  104. passwd Command
  105. pidof Command
  106. ping Command
  107. ps Command
  108. pstree Command
  109. pwd Command
  110. rdiff-backup Command
  111. reboot Command
  112. rename Command
  113. rm command
  114. rmdir Command
  115. scp Command
  116. shutdown Command
  117. sleep Command
  118. sort Command
  119. split Command
  120. ssh Command
  121. stat Command
  122. su Command
  123. sudo Command
  124. sum Command
  125. tac Command
  126. tail Command
  127. talk Command
  128. tar Command
  129. tee Command
  130. tree Command
  131. time Command
  132. top Command
  133. touch Command
  134. tr Command
  135. uname Command
  136. uniq Command
  137. uptime Command
  138. users Command
  139. vim/vi Command
  140. w Command
  141. wall Command
  142. watch Command
  143. wc Command
  144. wget Command
  145. whatis Command
  146. which Command
  147. who Command
  148. whereis Command
  149. xargs Command
  150. yes Command
  151. youtube-dl Command
  152. zcmp/zdiff Command
  153. zip Command
  154. zz Command
  155. 26 thoughts on “A – Z Linux Commands – Overview with Examples”
  156. Got something to say? Join the discussion. Cancel reply

Printing commands in linux

Printing Commands in Linux or Debain Linux

Linux includes a number of command line tools for administering printing. These commands are useful on networks, or for troubleshooting and managing printing on any system.

Each printer on a Linux system has its own spool or queue in the /var /spool/lpd directory. This spool uses the short name of the printer, which is created when the printer is first configured. When a file is printed, it becomes a job in the spool. Each job is stored in a spool until it is printed.

Printing tools generally start with lp (short for «line printer»). If you are familiar with other Linux commands, you can usually make a good guess at what the rest of the command should be. For example, lprm removes a print job from the spool

You can use the following tools for managing printing

lpq : Checks the status of print jobs.
lprm : Removes a print job from a spool.
lpstat : Reads the status of a spool.

Checking the Status of Print Jobs

lpq options user

The command’s name comes from the fact that a spool is sometimes called a «queue.»

The lpq Command (Print Jobs) Options

-l — Prints information for each file in the printer queue.

number — Checks the status of a job number.

-P printer — Sets the printer that a job should Use.

If you want to know more options check lpq man page

Sends requests to a line printer

lp options files

If you want to know more options check lp man page

Removing Jobs From a Printer Spool

lprm options job user

The command’s name comes from the fact that it removes (rm) a job from a line printer (lp).

Only the root user can remove a job sent by another user.

Regular users can remove their own print jobs.

Use lpstat to find job numbers.

The lprm Command (Remove Print Jobs) Options

-P printer — Sets the printer to Use.

— user — Removes all jobs sent by the user specified.

If you want to know more options check lprm man page

Reading the Status of a Printer Spool

lpstat -t options

If you want to know more options check lpstat man page

Printing From the Command Line

lpr options files

The lpr Command (Print) Options

-P printer — Selects the printer to Use.

-s — This option saves time and disk space for large files, but may cause printing to be slower.

If you want to know more options check lpr man page

Источник

Печать из командной строки Linux

Оригинал: Printing from the Linux command line
Автор: Sandra Henry-Stocker
Дата публикации: 20 марта 2019 года
Перевод: А. Кривошей
Дата перевода: апрель 2016 г.

Печать из командной строки Linux очень проста. Вы используете команду lp, чтобы запросить печать, и lpq, чтобы увидеть, какие задания на печать находятся в очереди, но все становится немного сложнее, когда вы хотите печатать на двух сторонах листа или в портретном режиме. И есть много других вещей, которые вы можете захотеть сделать — например, распечатать несколько копий документа или отменить задание на печать. Давайте проверим некоторые опции, чтобы, когда вы печатаете из командной строки, ваши распечатки выглядели именно так, как вы хотите.

Вывод параметров принтера

Чтобы просмотреть настройки принтера из командной строки, используйте команду lpoptions. Вывод должен выглядеть примерно так:

Этот вывод, вероятно, будет немного более дружественным к человеку, если вы превратите его пробелы в возврат каретки. Обратите внимание, сколько настроек указано в списке.

ПРИМЕЧАНИЕ. В приведенном ниже выводе некоторые строки были повторно связаны, чтобы сделать этот вывод более читабельным.

С опцией -v команда lpinfo выведет список драйверов и связанной с ними информации.

Команда lpoptions покажет настройки вашего принтера по умолчанию. Используйте параметр -p, чтобы указать один из нескольких доступных принтеров.

Команда lpstat -p отображает состояние принтера, а команда lpstat -p -d также выводит список доступных принтеров.

Полезные команды

Чтобы распечатать документ на принтере по умолчанию, просто используйте команду lp, а затем имя файла, который вы хотите распечатать. Если имя файла содержит пробелы (что редко встречается в системах Linux), либо поместите имя в кавычки, либо начните вводить имя файла и нажмите клавишу табуляции, чтобы вызвать завершение файла (как показано во втором примере ниже).

Команда lpq отображает очередь печати.

Команда lp с опцией -n позволяет вам указать количество копий, которое вы хотите напечатать.

Чтобы отменить задание на печать, вы можете использовать команду cancel или lprm. Если вы не будете действовать быстро, то можете увидеть это:

Двусторонняя печать

Чтобы печатать в двухстороннем режиме, вы можете ввести команду lp с параметром sides, в котором указано, как печатать на обеих сторонах листа, и вид переплета (сбоку или сверху). Этот параметр представляет обычный способ, при которым вы получите двусторонний документ в портретном режиме.

Если вы хотите, чтобы все ваши документы печатались в двухстороннем режиме, вы можете изменить настройки lp для sides с помощью команды lpoptions.

Чтобы вернуться к односторонней печати, вы должны использовать такую команду:

Печать в ландшафтном режиме

Для печати в ландшафтном режиме вы должны использовать параметр landscape с командой lp.

Система печати, используемая в системах Linux, — это основанная на стандартах система печати с открытым исходным кодом, называемая CUPS, первоначально обозначавшая Common Unix Printing System. Она позволяет компьютеру выступать в качестве сервера печати.

Источник

How can I print the command line output directly to the printer.

I am using ubuntu server 12.04 and I have to copy files into a shared directory and then download them from a desktop ubuntu distribution to print them.

Any help is appreciated

8 Answers 8

Mainly there are two default commands:

man lpr gives the output:

lpr submits files for printing. Files named on the command line are sent to the named printer (or the default destination if no destination is specified). If no files are listed on the command-line, lpr reads the print file from the standard input.

man lp gives the output:

lp submits files for printing or alters a pending job. Use a filename of «-» to force printing from the standard input.

so easily use the command:

This will print the man page from firefox to the specified printer

If you have them installed, another pair of options worth knowing about are

These are useful for providing numbered pages with headings and optional line-numbers. You can also use then to print booklet style (e.g. two pages on each side of a sheet)

I use these with Postscript-capable printers but I believe that Ubuntu’s print system can rasterize PS for any supported printer.

You may want to find out how the printer is accessed first — lpstat will give you that information. If you compare its output across both systems, you can probably tell whether the printer in question has been configured on both of them. lpstat -p -d lists all printers with their status and tells which one has been set as default printer.

You can simply pipe your output to the lp or lpr command then. You may want to insert a filter for pretty-printing or pagination though. There’s a good summary of tools at the debian manual «Highlighting and formatting plain text data», but I’m usually just using sed to highlight prompts and other stuff before sending everything through a2ps

To print a .txt file in a use :

You can use the lp command.

To print the output of a command to the default printer (use lpstat -d to see what the default printer is):

To print to a specific printer (use lpstat -p | awk ‘‘ to list available printer names):

To print a file, rather than a command output:

The question is about how to print from the command line on a server, and it sounds like you don’t yet have any printers defined on that system. I don’t have a system to check on so the following are approximate, but they should give you the general idea:

  1. Make sure the CUPS system is installed and running. It provides the daemons that will handle your print jobs.
  2. Once this is up, you need to set up one or more network printers to print to. The usual way to install printers is with the Printer Admin utility, but you evidently aren’t set up to run any GUI programs from your server— just commandline access via ssh. Since you already have an Ubuntu desktop system on the same network, I’d try copying the contents of the directory /etc/cups from the desktop box to the server. It should contain all the printer definitions and drivers you need. Check the files for any necessary adjustments (in case your set-up mentions user IDs or passwords that differ between the two systems), restart cupsd , and if you’re lucky you’ll be able to use lpr to print from the commandline.
Читайте также:  Linux cat номера строк

PS. In a pinch, you could install enough X utilities to run the Print Admin GUI utility via a remote X connection to your desktop Ubuntu box (log in with ssh -X ), and define the printers you need. But hopefully this won’t be necessary.

Источник

I simply can print a message in terminal using linux echo command.

Can I have the same output with print command.

I actually went through their manuals, where $ man print describes it as Run-mailcap-programs which term I never heard before. And came to know that it is used to find the correct program to open a file with, based on MIME.

So is there any way to print a simple line using print alone instead of echo ?

Found similar kind of problem at Need to assign the contents of a text file to a variable in a bash script, but people suggesting echo over print there.

I tried following, but got issues.

It asks for a file, with file provided.

But got working in combination with awk command with a file provided,

2 Answers 2

You’re confusing many things here, let me try and tease this apart for you.

This has nothing to do with the print you’re asking about. awk is a dynamic programming language which contains its own commands, of which print is one of them.

print —«text/plain» «prayag works on JVM» and other forms

The command print is for displaying files per the contents of the mailcap file, using the designated «handler» for each particular file type, not for printing strings to the screen.

excerpt from the print man page

run-mailcap, view, see, edit, compose, print — execute programs via entries in the mailcap file

run-mailcap (or any of its aliases) will use the given action to process each mime-type/file in turn. Each file is spec‐ ified as its mime-type, its encoding (e.g. compression), and filename together, separated by colons. If the mime-type is omitted, an attempt to determine the type is made by trying to match the file’s extension with those in the mime.types files. If the encoding is omitted, it will also be determined from the file’s extensions. Currently supported encodings are gzip (.gz), bzip (.bz), bzip2 (.bz2), and compress (.Z). A filename of «-» can be used to mean «standard input», but then a mime-type must be specified.

The command echo is a builtin command to the shell you’re using called Bash (I’m assuming you’re using Bash). You can confirm this by using this command:

You’ll notice that echo is also a standalone executable, /bin/echo . This is a different command than the echo you’re using, but serves a similar purpose.

print in shells such as zsh/ksh

Thanks to @Gilles comment, the print command you’re looking for is most likely the one that is built into shells such as zsh and/or ksh . You can see its usage through the man page, man zshbuiltins .

Example

You can run one of these shells by typing zsh or ksh .

printf

Perhaps you’re looking for the command printf ?

The command printf takes a formatting set of special characters so that you can instruct it how you want to display things such as strings or digits etc. See the man page for printf .

mailcap

So a lot of people are probably oblivious as to the file /etc/mailcap . This file contains mime-types (headers from files which identifies what type of file a file is). You can then create entries in this mailcap file which designate what tool to use to open a particular mime-type for a file.

Example

The above lines say that if you get a file with the mime-type audio/mpeg , then use the tool /usr/bin/mplayer to open this file.

These rules are generally used by the email tool, but other tools can take advantage of these entries within the mailcap file as well.

If you’re interested in learning more about mime-types or mailcap see the following references.

Источник

A – Z Linux Commands – Overview with Examples

Last Updated On: 7th October 2019

On this page

There are a countless number of commands in Linux. We are bound to use a number of them on a daily routine or numerous times to perform common tasks than others. It is important to note that certain commands are “distro-based” – they can only be found in specific distros. While others are generic Unix/Linux commands that you’ll find in all if not most mainstream distros.

In this article, we will introduce you a list of most frequently used Linux commands with their examples for easy learning. You can find the actual description of each Linux command in their manual page which you can access like this:

adduser/addgroup Command

The adduser and addgroup commands are used to add a user and group to the system respectively according to the default configuration specified in /etc/adduser.conf file.

For more adduser and addgroup commands: 15 Practical Examples on adduser Command in Linux

agetty Command

agetty is a program which manages physical or virtual terminals and is invoked by init. Once it detects a connection, it opens a tty port, asks for a user’s login name and calls up the /bin/login command. Agetty is a substitute of Linux getty:

alias Command

alias is a useful shell built-in command for creating aliases (shortcut) to a Linux command on a system. It is helpful for creating new/custom commands from existing Shell/Linux commands (including options):

The above command will create an alias called home for /home/tecmint/public_html directory, so whenever you type home in the terminal prompt, it will put you in the /home/tecmint/public_html directory.

anacron Command

anacron is a Linux facility used to run commands periodically with a frequency defined in days, weeks and months.

Unlike its sister cron; it assumes that a system will not run continuously, therefore if a scheduled job is due when the system is off, it’s run once the machine is powered on.

For more information about anacron and cron read: Cron Vs Anacron: How to Schedule Jobs Using Anacron on Linux

apropos Command

apropos command is used to search and display a short man page description of a command/program as follows.

apt Command

apt tool is a relatively new higher-level package manager for Debian/Ubuntu systems:

apt-get Command

apt-get is a powerful and free front-end package manager for Debian/Ubuntu systems. It is used to install new software packages, remove available software packages, upgrade existing software packages as well as upgrade entire operating system.

aptitude Command

aptitude is a powerful text-based interface to the Debian GNU/Linux package management system. Like apt-get and apt; it can be used to install, remove or upgrade software packages on a system.

arch Command

arch is a simple command for displaying machine architecture or hardware name (similar to uname -m):

arp Command

ARP (Address Resolution Protocol) is a protocol that maps IP network addresses of a network neighbor with the hardware (MAC) addresses in an IPv4 network.

You can use it as below to find all alive hosts on a network:

at Command

at command is used to schedule tasks to run in a future time. It’s an alternative to cron and anacron, however, it runs a task once at a given future time without editing any config files:

For example, to shutdown the system at 23:55 today, run:

atq Command

atq command is used to view jobs in at command queue:

atrm Command

atrm command is used to remove/deletes jobs (identified by their job number) from at command queue:

For more usage about at command, read: How to Use ‘at’ Command to Schedule a Task in Linux

awk Command

Awk is a powerful programming language created for text processing and generally used as a data extraction and reporting tool.

For more Awk concepts (basic and advance) with simple and easy-to-understand, we’ve created a book that contains 13 chapters with a total of 41 pages, which covers all Awk basic and advance usage with practical examples: Awk Getting Started Guide for Beginners

batch Command

batch is also used to schedule tasks to run a future time, similar to the at command.

basename Command

basename command helps to print the name of a file stripping of directories in the absolute path:

bc Command

bc is a simple yet powerful and arbitrary precision CLI calculator language which can be used like this:

bg Command

bg is a command used to send a process to the background.

bzip2 Command

bzip2 command is used to compress or decompress file(s).

cal Command

The cal command print a calendar on the standard output.

cat Command

cat command is used to view contents of a file or concatenate files, or data provided on standard input, and display it on the standard output.

To learn more about cat command, read: 13 Useful Cat Command Examples on Linux

chgrp Command

chgrp command is used to change the group ownership of a file. Provide the new group name as its first argument and the name of file as the second argument like this:

chmod Command

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

chown Command

chown command changes/updates the user and group ownership of a file/directory like this.

To learn more about chgrp, chmod and chwon commands, read: Managing Users & Groups, File Permissions & Attributes in Linux

Читайте также:  Genius islim 2000af драйвер windows

cksum Command

cksum command is used to display the CRC checksum and byte count of an input file.

clear Command

clear command lets you clear the terminal screen, simply type.

cmp Command

cmp performs a byte-by-byte comparison of two files like this.

comm Command

comm command is used to compare two sorted files line-by-line as shown below.

cp Command

cp command is used for copying files and directories from one location to another.

For more information on how to copy files in Linux, read:

date Command

date command displays/sets the system date and time like this.

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

dd Command

dd command is used for copying files, converting and formatting according to flags provided on the command line. It can strip headers, extracting parts of binary files and so on.

The example below shows creating a boot-able USB device:

df Command

df command is used to show file system disk space usage as follows.

diff Command

diff command is used to compare two files line by line. It can also be used to find the difference between two directories in Linux like this:

dir Command

dir command works like Linux ls command, it lists the contents of a directory.

dmidecode Command

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:

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

du Command

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

echo Command

echo command prints a text of line provided to it.

eject Command

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

env Command

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

exit Command

exit command is used to exit a shell like so.

expr Command

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

factor Command

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

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.

Learn more on how to find files 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.

Learn more on how to find memory usage in 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.

Learn more about grep command usage in Linux.

groups Command

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

gzip Command

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

gunzip Command

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

head Command

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

history Command

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

Learn more about Linux history command.

hostname Command

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

hostnamectl Command

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

hwclock

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

hwinfo Command

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

Learn more about how to get Linux hardware info.

id Command

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

ifconfig Command

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

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:

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.

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).

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).

Learn more about iptables firewall in Linux.

iw Command

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

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.

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).

killall Command

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

Learn more about kill and killall command in Linux.

kmod Command

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

last Command

last command display a listing of last logged in users.

ln Command

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

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*):

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.

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.

To know more about ls command, read our guides.

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.

lscpu Command

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

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.

lsusb Command

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

man Command

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

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:

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).

more Command

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

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.

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.

To open a file using nano, type:

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.

Learn more examples and usage on 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:

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.

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.

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.

Читайте также:  Linux как открыть порты для ssh

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:

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.

pidof Command

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

ping Command

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

ps Command

pstree Command

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

pwd Command

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

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:

reboot Command

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

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.

rm command

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

rmdir Command

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

scp Command

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

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.

sleep Command

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

sort Command

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

Learn more examples of sort command in Linux.

split Command

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

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.

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

stat Command

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

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.

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.

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

sum Command

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

tac Command

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

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).

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 ‘[email protected]’.

tar Command

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

Learn more about tar command and its usage on Linux.

tee Command

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

tree Command

The tree command is a tiny, cross-platform command-line program used to recursively list or display the content of a directory in a tree-like format.

time Command

time command runs programs and summarizes system resource usage.

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.

touch Command

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

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.

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:

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.

uptime Command

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

users Command

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

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.

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

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.

wall Command

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

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.

wc Command

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

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.

whatis Command

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

which Command

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

who Command

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

whereis Command

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

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.

yes Command

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

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.

zcmp/zdiff Command

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

zip Command

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

zz Command

zz command is an alias of the fasd commandline tool that offers quick access to files and directories in Linux. It is used to quickly and interactively cd into a previously accessed directory by selecting the directory number from the first field as follows.

That’s it for now! As we mentioned before, there are a countless number of commands in Linux. The list is possibly longer than we can offer. Use the feedback form below to share any useful and frequently used commands missing in this list.

26 thoughts on “A – Z Linux Commands – Overview with Examples”

A very good list, but you list split but no join command?

Very good articles on the Linux commands, much appreciated the effort put into it…

I don’t know who has invented IT it is more demanding and tough to learn for those who are not passionate about it.

What is the command for print any file??

To print files in Linux from command-line.

Where is the cd command?

You are right! They are not executed cd command!

Really helpful articles on Linux commands, thanks a lot for putting all together..

Okay, let’s say for a second someone has made themselves admin WITHOUT MY PERMISSION… Can I remove them using Linux?

Gosh I hope so. This is a simplistic solution and doesn’t consider the actual situation that you may be in:

Of course you’ll want to figure out how they got admin without your permission (sudo config, shared password, etc.)

Of course you can. As long as you belong to the superuser groups. You need to use the *userdel* command to delete a user account and related files from user account under Linux.

The *userdel* is the way to do it on the command line.

Got something to say? Join the discussion. Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Источник

Оцените статью