Linux Command | Bash Script - How To?

SS64.com | Linux, MacOS, CMD, CLI

Accept user choices via keyboard input :: select

Add a user security group :: groupadd

Alter priority of running processes :: renice

Arbitrary precision calculator language :: bc

Archive files with compression :: rar

Base32 encode/decode data and print to standard output :: base32

Base64 encode/decode data and print to standard output :: base64

Briefly list directory contents :: dir

Browse or page through a text file :: most

Capture an X server screen and save the image to file :: import

Change access permissions :: chmod

Change Directory :: cd

Change file attributes on a Linux file system :: chattr

Change file owner and group :: chown

Change file timestamps :: touch

Change group ownership :: chgrp

Check file name portability :: pathchk

Clear the terminal screen/console (bash) :: clear_console

Clear the terminal screen/console (ncurses) :: clear

Colour setup for 'ls' :: dircolors

Command History :: history

Comment / Remark :: ###

Compare two files :: cmp

Compare two sorted files line by line :: comm

Compress or decompress .xz and .lzma files :: xz

Compress or decompress named file(s) :: bzip2

Compress or decompress named file(s) :: gzip

Compute and check MD5 message digest :: md5sum

Compute and check SHA256 (256-bit) checksums :: sha256sum

Concatenate and print (display) the content of files :: cat

Conditionally perform a command :: case

Conditionally perform a command :: if

Configure a network interface :: ifconfig

Convert a full pathname to just a path :: dirname

Convert spaces to tabs :: unexpand

Convert tabs to spaces :: expand

Convert the character set of a file :: iconv

Convert units from one scale to another :: units

Copy files and set attributes :: install

Copy files between two machines :: rcp

Copy files to and from archives :: cpio

Copy one or more files to another location :: cp

Create a function variable • :: local

Create a hybrid ISO9660/JOLIET/HFS filesystem :: mkisofs

Create a link to a file :: link

Create a symbolic link to a file :: ln

Create an alias • :: alias

Create new folder(s) :: mkdir

Create new user account :: useradd

Daemon to execute scheduled commands :: cron

Data Duplicator - convert and copy a file, write disk headers, boot records :: dd

Data recovery tool :: ddrescue

Declare variables and give them attributes • :: declare

Decode a file created by uuencode :: uudecode

Define Function Macros :: function

Delay for a specified time :: sleep

Delete a group :: groupdel

Delete a print job :: lprintd

Delete a user account :: userdel

Describe a command • :: type

Desk Calculator :: dc

Determine file type :: file

Display a calendar :: cal

Display disk usage and limits :: quota

Display file or file system status :: stat

Display free disk space :: df

Display help for a built-in command • :: help

Display lines beginning with a given string :: look

Display list of remembered directories :: dirs

Display memory usage :: free

Display message on screen • :: echo

Display or change the date & time :: date

Display output one screen at a time :: less

Display output one screen at a time :: more

Display the differences between two files :: diff

Divide a file into several parts :: cut

DNS lookup :: dig

Do nothing, successfully :: TRUE

Do nothing, unsuccessfully :: FALSE

Eject removable media :: eject

Enable and disable builtin shell commands • :: enable

Encode a binary file :: uuencode

Environment variables :: env

Estimate file space usage :: du

Ethernet card settings :: ethtool

Evaluate a conditional expression :: test

Evaluate expressions :: expr

Evaluate several commands/arguments :: eval

Execute a command :: exec

Execute a command as another user :: sudo

Execute a command when the shell receives a signal • :: trap

Execute commands :: while

Execute commands (until error) :: until

Execute utility, passing constructed argument list(s) :: xargs

Execute/display a program periodically :: watch

Exit a login shell • :: logout

Exit a shell function :: return

Exit from a loop • :: break

Exit the shell :: exit

Expand words, and execute commands :: for

Extract files from a rar archive :: unrar

File system consistency check and repair :: fsck

File Transfer Protocol :: ftp

Find and Replace text within file(s) :: gawk

Find and Replace text, database sort/validate/index :: awk

Find files :: locate

Find files :: slocate

Format and print data • :: printf

Format disks or tapes :: format

Generate random permutations :: shuf

Get file access control lists :: getfacl

GNU Bourne-Again SHell :: bash

Help manual :: man

Identify/kill the process that is accessing a file :: fuser

Interactive process viewer :: htop

Join lines on a common field :: join

Kill a process by specifying its PID :: kill

Kill processes by name :: killall

Kill processes by name :: pkill

Limit user resources • :: ulimit

Line printer control program :: lpc

List active jobs • :: jobs

List all PCI devices :: lspci

List block devices :: lsblk

List cached Kerberos tickets :: klist

List file attributes on a Linux second extended file system :: lsattr

List information about file(s) :: ls

List open files :: lsof

List processes by name :: pgrep

List processes running on the system :: top

List the print queue :: lprintq

List users currently logged in :: users

Low-level format a floppy disk :: fdformat

Make a file :: mkfile

Make a hexdump or do the reverse :: xxd

Make a temporary file :: mktemp

Make block or character special files :: mknod

Make FIFOs (named pipes) :: mkfifo

Manipulate MS-DOS files :: mtools

Manipulate shell variables and functions :: set

Mark variables/functions as readonly :: readonly

Mass Move and rename (files) :: mmv

Measure Program running time :: time

Merge lines of files :: paste

Merge two files interactively :: sdiff

Modify a group :: groupmod

Modify a user password :: passwd

Modify user account :: usermod

Monitor the progress of data through a pipe :: pv

Mount a file system :: mount

Move or rename files or directories :: mv

Multiplex terminal, run remote shells via ssh :: screen

Netcat, read and write data across networks :: nc

Network diagnostics (traceroute/ping) :: mtr

Networking connections/stats :: netstat

nftables for packet filtering and classification :: nft

Number lines and write files :: nl

Open a file in its default application :: open

Open a file or URL in the user’s preferred application. :: xdg-open

Operator access :: op

Output the first part of file(s) :: head

Output the last part of a file :: tail

Package and compress (archive) files :: zip

Package manager (Debian/Ubuntu). :: dpkg

Parse positional parameters :: getopts

Partition table manipulator for Linux :: cfdisk

Partition table manipulator for Linux :: fdisk

Perform arithmetic on shell variables • :: let

Performance analysis tools for Linux :: Perf

Prepare files for printing :: pr

Print a checksum for a file :: sum

Print a file :: lprint

Print a string until interrupted :: yes

Print all usernames currently logged in :: who

Print byte, word, and line counts :: wc

Print CRC checksum and byte counts :: cksum

Print current login name :: logname

Print environment variables :: printenv

Print filename of terminal on stdin :: tty

Print files :: lpr

Print group names a user is in :: groups

Print kernel & driver messages :: dmesg

Print numeric sequences :: seq

Print or set system name :: hostname

Print system information :: uname

Print the current user id and name ('id -un') :: whoami

Print user and group id’s :: id

Print Working Directory :: pwd

Printer capability database :: printcap

Process status :: ps

Query Internet name servers interactively :: nslookup

ram disk device :: ram

Read a line from standard input • :: read

Read from stdin into an array variable • :: readarray

Read lines from standard input into an indexed array variable • :: mapfile

Reboot the system :: reboot

Recompile a group of programs :: make

Redirect output to multiple files :: tee

Reformat paragraph text :: fmt

Remember the full pathname of a name argument :: hash

Remote file copy (Synchronize file trees) :: rsync

Remove an alias • :: unalias

Remove files :: rm

Remove folder(s) :: rmdir

Remove jobs from the print queue :: lprm

Remove variable or function names :: unset

Rename files :: rename

Report CPU and i/o statistics :: iostat

Report virtual memory statistics :: vmstat

Restore the previous value of the current directory :: popd

Resume the next iteration of a loop • :: continue

Retrieve web pages or files via HTTP, HTTPS or FTP :: wget

Return the context of any active subroutine call • :: caller

Reverse lines of a file :: rev

Routing, devices and tunnels :: ip

Run a command - ignoring shell functions • :: command

Run a command immune to hangups :: nohup

Run a command script in the current shell :: .

Run a command with a different root directory :: chroot

Run a command with a time limit :: timeout

Run a shell builtin :: builtin

Run commands from a file '.'  • :: source

Run the last command again :: !!

Save and then change the current directory :: pushd

Scan a file system for disk usage :: quotacheck

Schedule a command to run at a later time :: crontab

Schedule a command to run once at a particular time :: at

Search file(s) for lines that match a fixed string :: fgrep

Search file(s) for lines that match a given pattern :: grep

Search file(s) for lines that match an extended expression :: egrep

Search for and install software packages (Debian/Ubuntu) :: apt

Search for and install software packages (Debian/Ubuntu) :: apt-get

Search for and install software packages (Debian/Ubuntu) :: aptitude

Search for files that meet a desired criteria :: find

Search Help manual pages (man -k) :: apropos

Search the user’s $path for a program file :: which

Search the user’s $path, man pages and source files for a program :: whereis

Secure copy (remote file copy) :: scp

Secure File Transfer Program :: sftp

Secure Shell client (remote login program) :: ssh

Send a message to another user :: write

Send desktop notifications :: notify-send

Send job to foreground :: fg

Send to background :: bg

Set an environment variable :: export

Set file access control lists. :: setfacl

Set or display readline key and function bindings • :: bind

Set tabs on a terminal :: tabs

Set terminal-dependent capabilities, color, position :: tput

Set the priority of a command or job :: nice

Shell Options :: shopt

Shift positional parameters :: shift

Show differences among three files :: diff3

Show uptime :: uptime

Show who is logged on and what they are doing :: w

Shutdown or restart Linux :: shutdown

Socket Statistics :: ss

Sort text files :: sort

Spell Checker :: aspell

Split a file into context-determined pieces :: csplit

Split a file into fixed-size pieces :: split

Start a network interface up :: ifup

Start a new process in the background :: &

Stop a network interface :: ifdown

Store, list or extract files in an archive :: tar

Stream Editor :: sed

Strip directory and suffix from filenames :: basename

Substitute user identity :: su

Suspend execution of this shell • :: suspend

Synchronize data on disk with memory :: sync

Synchronize remote files via email :: remsync

System services (runlevel) :: chkconfig

Terminal multiplexer :: tmux

Test a network connection :: ping

Text Editor :: vi

Topological sort :: tsort

Trace Route to Host :: traceroute

Trace system calls and signals :: strace

Transfer data from or to a server :: curl

Translate, squeeze, and/or delete characters :: tr

Uniquify files :: uniq

UNIX to Windows or MAC text file format converter :: unix2dos

Unmount a device :: umount

Unpack shell archive scripts :: unshar

Update passwords in batch mode :: chpasswd

User and system times :: times

Users file creation mask :: umask

Verbosely list directory contents ('ls -l -b') :: v

Verbosely list directory contents ('ls -l -b') :: vdir

Wait for a process to complete • :: wait

Windows/MAC to UNIX text file format converter :: dos2unix

Wrap text to fit a specified width :: fold