More Linux Bash Commands

Hello reader,

While we can find most of these by searching directly in the terminal it isn’t always practical to stop a task to search via –help. Often we resort to a browser to quickly find a command so hopefully this ends up a result of that search. *All commands listed below were available in bash 4.3.42 x86_64 as of August 13th 2016.

GNU bash, version 4.3.42(1)-release (x86_64-pc-linux-gnu)
These shell commands are defined internally. Type `help’ to see this list.
Type `help name’ to find out more about the function `name’.
Use `info bash’ to find out more about the shell in general.
Use `man -k’ or `info’ to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

job_spec [&] history [-c] [-d offset] [n] or hist>
(( expression )) if COMMANDS; then COMMANDS; [ elif C>
. filename [arguments] jobs [-lnprs] [jobspec …] or jobs >
: kill [-s sigspec | -n signum | -sigs>
[ arg… ] let arg [arg …]
[[ expression ]] local [option] name[=value] …
alias [-p] [name[=value] … ] logout [n]
bg [job_spec …] mapfile [-n count] [-O origin] [-s c>
bind [-lpsvPSVX] [-m keymap] [-f file> popd [-n] [+N | -N]
break [n] printf [-v var] format [arguments]
builtin [shell-builtin [arg …]] pushd [-n] [+N | -N | dir]
caller [expr] pwd [-LP]
case WORD in [PATTERN [| PATTERN]…)> read [-ers] [-a array] [-d delim] [->
cd [-L|[-P [-e]] [-@]] [dir] readarray [-n count] [-O origin] [-s>
command [-pVv] command [arg …] readonly [-aAf] [name[=value] …] o>
compgen [-abcdefgjksuv] [-o option] > return [n]
complete [-abcdefgjksuv] [-pr] [-DE] > select NAME [in WORDS … ;] do COMM>
compopt [-o|+o option] [-DE] [name ..> set [-abefhkmnptuvxBCHP] [-o option->
continue [n] shift [n]
coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname …]
declare [-aAfFgilnrtux] [-p] [name[=v> source filename [arguments]
dirs [-clpv] [+N] [-N] suspend [-f]
disown [-h] [-ar] [jobspec …] test [expr]
echo [-neE] [arg …] time [-p] pipeline
enable [-a] [-dnps] [-f filename] [na> times
eval [arg …] trap [-lp] [[arg] signal_spec …]
exec [-cl] [-a name] [command [argume> true
exit [n] type [-afptP] name [name …]
export [-fn] [name[=value] …] or ex> typeset [-aAfFgilrtux] [-p] name[=va>
false ulimit [-SHabcdefilmnpqrstuvxT] [lim>
fc [-e ename] [-lnr] [first] [last] o> umask [-p] [-S] [mode]
fg [job_spec] unalias [-a] name [name …]
for NAME [in WORDS … ] ; do COMMAND> unset [-f] [-v] [-n] [name …]
for (( exp1; exp2; exp3 )); do COMMAN> until COMMANDS; do COMMANDS; done
function name { COMMANDS ; } or name > variables – Names and meanings of so>
getopts optstring name [arg] wait [-n] [id …]
hash [-lr] [-p pathname] [-dt] [name > while COMMANDS; do COMMANDS; done
help [-dms] [pattern …] { COMMANDS ; }

Also:

GNU long options:
–debug
–debugger
–dump-po-strings
–dump-strings
–help
–init-file
–login
–noediting
–noprofile
–norc
–posix
–rcfile
–restricted
–verbose
–version
Shell options:
-ilrsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
Type `bash -c “help set”‘ for more information about shell options.

Lets not forget sudo options:

sudo – execute a command as another user

usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p
prompt] [-u user] file …

Options:
-A, –askpass use a helper program for password prompting
-b, –background run command in the background
-C, –close-from=num close all file descriptors >= num
-E, –preserve-env preserve user environment when running command
-e, –edit edit files instead of running a command
-g, –group=group run command as the specified group name or ID
-H, –set-home set HOME variable to target user’s home dir
-h, –help display help message and exit
-h, –host=host run command on host (if supported by plugin)
-i, –login run login shell as the target user; a command may
also be specified
-K, –remove-timestamp remove timestamp file completely
-k, –reset-timestamp invalidate timestamp file
-l, –list list user’s privileges or check a specific
command; use twice for longer format
-n, –non-interactive non-interactive mode, no prompts are used
-P, –preserve-groups preserve group vector instead of setting to
target’s
-p, –prompt=prompt use the specified password prompt
-r, –role=role create SELinux security context with specified
role
-S, –stdin read password from standard input
-s, –shell run shell as the target user; a command may also
be specified
-t, –type=type create SELinux security context with specified
type
-U, –other-user=user in list mode, display privileges for user
-u, –user=user run command (or edit file) as specified user name
or ID
-V, –version display version information and exit
-v, –validate update user’s timestamp without running a command
— stop processing command line arguments

Apt Commands:

apt
Usage: apt command [options]
apt help command [options]

Commands:
add-repository – Add entries to apt sources.list
autoclean – Erase old downloaded archive files
autoremove – Remove automatically all unused packages
build – Build binary or source packages from sources
build-dep – Configure build-dependencies for source packages
changelog – View a package’s changelog
check – Verify that there are no broken dependencies
clean – Erase downloaded archive files
contains – List packages containing a file
content – List files contained in a package
deb – Install a .deb package
depends – Show raw dependency information for a package
dist-upgrade – Upgrade the system by removing/installing/upgrading packages
download – Download the .deb file for a package
edit-sources – Edit /etc/apt/sources.list with your preferred text editor
dselect-upgrade – Follow dselect selections
full-upgrade – Same as ‘dist-upgrade’
held – List all held packages
help – Show help for a command
hold – Hold a package
install – Install/upgrade packages
list – List packages based on package names
policy – Show policy settings
purge – Remove packages and their configuration files
recommends – List missing recommended packages for a particular package
rdepends – Show reverse dependency information for a package
reinstall – Download and (possibly) reinstall a currently installed package
remove – Remove packages
search – Search for a package by name and/or expression
show – Display detailed information about a package
showhold – Same as ‘held’
source – Download source archives
sources – Same as ‘edit-sources’
unhold – Unhold a package
update – Download lists of new/upgradable packages
upgrade – Perform a safe upgrade
version – Show the installed version of a package

Install has it’s own options:

Usage: install [OPTION]… [-T] SOURCE DEST
or: install [OPTION]… SOURCE… DIRECTORY
or: install [OPTION]… -t DIRECTORY SOURCE…
or: install [OPTION]… -d DIRECTORY…

This install program copies files (often just compiled) into destination
locations you choose. If you want to download and install a ready-to-use
package on a GNU/Linux system, you should instead be using a package manager
like yum(1) or apt-get(1).

In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to
the existing DIRECTORY, while setting permission modes and owner/group.
In the 4th form, create all components of the given DIRECTORY(ies).

Mandatory arguments to long options are mandatory for short options too.
–backup[=CONTROL] make a backup of each existing destination file
-b like –backup but does not accept an argument
-c (ignored)
-C, –compare compare each pair of source and destination files, and
in some cases, do not modify the destination at all
-d, –directory treat all arguments as directory names; create all
components of the specified directories
-D create all leading components of DEST except the last,
or all components of –target-directory,
then copy SOURCE to DEST
-g, –group=GROUP set group ownership, instead of process’ current group
-m, –mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x
-o, –owner=OWNER set ownership (super-user only)
-p, –preserve-timestamps apply access/modification times of SOURCE files
to corresponding destination files
-s, –strip strip symbol tables
–strip-program=PROGRAM program used to strip binaries
-S, –suffix=SUFFIX override the usual backup suffix
-t, –target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY
-T, –no-target-directory treat DEST as a normal file
-v, –verbose print the name of each directory as it is created
–preserve-context preserve SELinux security context
-Z set SELinux security context of destination
file to default type
–context[=CTX] like -Z, or if CTX is specified then set the
SELinux or SMACK security context to CTX
–help display this help and exit
–version output version information and exit

The backup suffix is ‘~’, unless set with –suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the –backup option or through
the VERSION_CONTROL environment variable. Here are the values:

none, off never make backups (even if –backup is given)
numbered, t make numbered backups
existing, nil numbered if numbered backups exist, simple otherwise
simple, never always make simple backups

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/install>
or available locally via: info ‘(coreutils) install invocation’

These are from Git 

usage: git [–version] [–help] [-C <path>] [-c name=value]
[–exec-path[=<path>]] [–html-path] [–man-path] [–info-path]
[-p | –paginate | –no-pager] [–no-replace-objects] [–bare]
[–git-dir=<path>] [–work-tree=<path>] [–namespace=<name>]
<command> [<args>]

These are common Git commands used in various situations:

start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one

work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index

examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status

grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Forward-port local commits to the updated upstream head
tag Create, list, delete or verify a tag object signed with GPG

collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects

‘git help -a’ and ‘git help -g’ list available subcommands and some
concept guides. See ‘git help <command>’ or ‘git help <concept>’
to read about a specific subcommand or concept.

Git help -a

usage: git [–version] [–help] [-C <path>] [-c name=value]
[–exec-path[=<path>]] [–html-path] [–man-path] [–info-path]
[-p | –paginate | –no-pager] [–no-replace-objects] [–bare]
[–git-dir=<path>] [–work-tree=<path>] [–namespace=<name>]
<command> [<args>]

available git commands in ‘/usr/lib/git-core’

add merge-ours
add–interactive merge-recursive
am merge-resolve
annotate merge-subtree
apply merge-tree
archive mergetool
bisect mktag
bisect–helper mktree
blame mv
branch name-rev
bundle notes
cat-file pack-objects
check-attr pack-redundant
check-ignore pack-refs
check-mailmap patch-id
check-ref-format prune
checkout prune-packed
checkout-index pull
cherry push
cherry-pick quiltimport
clean read-tree
clone rebase
column receive-pack
commit reflog
commit-tree relink
config remote
count-objects remote-ext
credential remote-fd
credential-cache remote-ftp
credential-cache–daemon remote-ftps
credential-store remote-http
daemon remote-https
describe remote-testsvn
diff repack
diff-files replace
diff-index request-pull
diff-tree rerere
difftool reset
difftool–helper rev-list
fast-export rev-parse
fast-import revert
fetch rm
fetch-pack send-pack
filter-branch sh-i18n–envsubst
fmt-merge-msg shell
for-each-ref shortlog
format-patch show
fsck show-branch
fsck-objects show-index
gc show-ref
get-tar-commit-id stage
grep stash
hash-object status
help stripspace
http-backend submodule
http-fetch submodule–helper
http-push subtree
imap-send symbolic-ref
index-pack tag
init unpack-file
init-db unpack-objects
instaweb update-index
interpret-trailers update-ref
log update-server-info
ls-files upload-archive
ls-remote upload-pack
ls-tree var
mailinfo verify-commit
mailsplit verify-pack
merge verify-tag
merge-base web–browse
merge-file whatchanged
merge-index worktree
merge-octopus write-tree
merge-one-file

‘git help -a’ and ‘git help -g’ list available subcommands and some
concept guides. See ‘git help <command>’ or ‘git help <concept>’
to read about a specific subcommand or concept.

Finally Git help -g

The common Git guides are:

attributes Defining attributes per path
everyday Everyday Git With 20 Commands Or So
glossary A Git glossary
ignore Specifies intentionally untracked files to ignore
modules Defining submodule properties
revisions Specifying revisions and ranges for Git
tutorial A tutorial introduction to Git (for version 1.5.1 or newer)
workflows An overview of recommended workflows with Git

‘git help -a’ and ‘git help -g’ list available subcommands and some
concept guides. See ‘git help <command>’ or ‘git help <concept>’
to read about a specific subcommand or concept.

 

Spread the love

1,227 thoughts on “More Linux Bash Commands”

  1. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back later. All the best

  2. Whoa! This blog looks just like my old one! It’s on a totally different topic but it has pretty much the same page layout and design. Great choice of colors!

  3. Do you have a spam problem on this website; I also am a blogger, and I was wondering your situation; we have developed some nice procedures and we are looking to trade strategies with other folks, why not shoot me an e-mail if interested.

  4. Do you have a spam problem on this site; I also am a blogger, and I was curious about your situation; many of us have developed some nice procedures and we are looking to swap methods with others, please shoot me an email if interested.

  5. Neat blog! Is your theme custom made or did you download it from somewhere? A theme like yours with a few simple adjustements would really make my blog jump out. Please let me know where you got your theme. Appreciate it

  6. Hi! This is kind of off topic but I need some guidance from an established blog. Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty fast. I’m thinking about setting up my own but I’m not sure where to begin. Do you have any ideas or suggestions? Many thanks

  7. Hi! This is my first comment here so I just wanted to give a quick shout out and tell you I truly enjoy reading your articles. Can you suggest any other blogs/websites/forums that go over the same subjects? Thanks!

  8. Nice read, I just passed this onto a colleague who was doing a little research on that. And he just bought me lunch because I found it for him smile Therefore let me rephrase that: Thank you for lunch!

  9. Of course, what a great site and revealing posts, I definitely will bookmark your website.Best Regards!

  10. Hey there just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Opera. I’m not sure if this is a format issue or something to do with web browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the issue fixed soon. Kudos

  11. I know this if off topic but I’m looking into starting my own blog and was wondering what all is required to get setup? I’m assuming having a blog like yours would cost a pretty penny? I’m not very web smart so I’m not 100% sure. Any suggestions or advice would be greatly appreciated. Thank you

  12. Have you ever considered publishing an e-book or guest authoring on other sites? I have a blog based on the same ideas you discuss and would love to have you share some stories/information. I know my visitors would appreciate your work. If you are even remotely interested, feel free to send me an e mail.

  13. Hey there! I know this is somewhat off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding one? Thanks a lot!

  14. I like what you guys are up too. Such clever work and exposure! Keep up the very good works guys I’ve incorporated you guys to my blogroll.

  15. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t show up. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say wonderful blog!

  16. My spouse and I stumbled over here from a different page and thought I should check things out. I like what I see so now i’m following you. Look forward to looking at your web page for a second time.

  17. Hello there! This post could not be written any better! Reading through this post reminds me of my previous room mate! He always kept talking about this. I will forward this page to him. Fairly certain he will have a good read. Many thanks for sharing!

  18. Awesome blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog jump out. Please let me know where you got your theme. With thanks

  19. Hey there! I could have sworn I’ve been to this website before but after reading through some of the post I realized it’s new to me. Anyhow, I’m definitely delighted I found it and I’ll be bookmarking and checking back frequently!

  20. Fantastic blog! Do you have any tips for aspiring writers? I’m hoping to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely confused .. Any ideas? Thanks a lot!

  21. Hey! Do you know if they make any plugins to safeguard against hackers? I’m kinda paranoid about losing everything I’ve worked hard on. Any tips?

  22. First of all I would like to say fantastic blog! I had a quick question which I’d like to ask if you do not mind. I was interested to know how you center yourself and clear your mind prior to writing. I’ve had a difficult time clearing my mind in getting my ideas out. I truly do enjoy writing but it just seems like the first 10 to 15 minutes are generally lost simply just trying to figure out how to begin. Any recommendations or tips? Many thanks!

  23. Hmm is anyone else experiencing problems with the pictures on this blog loading? I’m trying to determine if its a problem on my end or if it’s the blog. Any feedback would be greatly appreciated.

  24. Neat blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple adjustements would really make my blog shine. Please let me know where you got your theme. Kudos

  25. Hey there! Someone in my Myspace group shared this website with us so I came to look it over. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Fantastic blog and amazing style and design.

  26. Hello! This is kind of off topic but I need some guidance from an established blog. Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about making my own but I’m not sure where to start. Do you have any points or suggestions? Many thanks

  27. Hi exceptional website! Does running a blog like this take a massive amount work? I have virtually no understanding of coding but I was hoping to start my own blog soon. Anyways, if you have any ideas or techniques for new blog owners please share. I understand this is off topic however I simply wanted to ask. Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *