Skip to content

benjamin-white-dsk/bash-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 

Repository files navigation

BASH SHELL COMMANDS —

  • && : Execute one command and then another.
  • > : Output and overwrite contents.
  • >> : Output and append contents.
  • | : Used to redirect function output.
  • alias : Used to create a mnemonic reference to a command.
  • apt-get : On many Linux builds used to search for and install software.
  • aptitude : Seems to be an alias for 'apt-get'.
  • aspell : Spell checker function.
  • awk : Used for find and replace with pattern matching.
  • bind : Can be used to bind a key to a function.
  • mv : Used to move or rename a file or directory.
  • break : As with higher languages, to exit a for or while loop.
  • builtin : Use to include a shell function within a command or function.
  • bzip2 : Compress or decompress [file] command.
  • cal : Display a calendar with current day highlighted.
  • case : Similar to higher languages switch, will conditionally execute a command when [argument] matches [pattern].
  • cat : Display the contents of a file.
  • cd : Change directory.
  • chgrp : Change file ownership to group.
  • chmod : Change file permissions.
  • chown : Set file ownership.
  • chroot : Run a command from a different root directory.
  • chkconfig : Used to query or set system services.
  • cksum : Computes the CRC value of a file.
  • clear : Will clear messages from the terminal display.
  • cmp : Compare two files data and return any differences.
  • comm : Compare contents (str) of two files line by line.
  • continue : Used to jump to the next iteration in a loop.
  • cp : Copy one or more files to a new location.
  • cron : Daemon for executing scheduled tasks.
  • crontab : Schedule a task to run at a later time.
  • csplit : Split and output a file based on a context pattern.
  • curl : Transfer data (or one file) to or from a server.
  • cut : Cuts a file into different parts, a bit like using 'slice' on an array.
  • date : View (or set with parameters) the current date and time.
  • dc : Desk calculator program.
  • dd : Can make an exact clone of an (unmounted) disk.
  • ddrescue : Can recover data from damaged files.
  • declare : Declare variables and assign values.
  • df : Shows free disk space.
  • diff : Compare two files.
  • dig : A DNS tool to query and troubleshoot nameservers.
  • dircolors : Use to setup colors for the 'ls' command.
  • echo : Writes string parameter to STDOUT or can be redirected to a file.
  • eject : Send an eject command to removable media.
  • enable : Can be used to enable or disable builtin shell commands.
  • env : Will display, set or remove environmental variables.
  • eval : Evaluates a command or expression.
  • exec : Executes a command.
  • exit : Leave the shell.
  • expect : Automates communication with an interactive application.
  • export : Can be used to set an environmental variable.
  • expr : Evaluates an expression and prints the result to STDOUT.
  • fdisk : Create or resize disk partitions.
  • fgrep : Can be faster than 'grep' if searching for multiple strings.
  • find : Search for files.
  • for : Execute 'commands' for each 'words'.
  • ftp : Launches an FTP prompt.
  • function : Declare a function.
  • fuser : Identify the process that is using a file or socket and optionally kill said process.
  • gawk : Same as 'awk.'
  • grep : Search a file for a text match.
  • groupadd : Can add a user security group.
  • groupdel : Inverse of above.
  • groupmod : Modify a group.
  • groups : Print the group name a user is in.
  • gzip : Compress or decompress a file.
  • head : Specify a leading amount of a file to output.
  • history : Display the command history.
  • hostname : Use to print or set the hostname.
  • htop : View system load per process.
  • iconv : Convert the character encoding of one or more files.
  • id : Print information about the current user.
  • if : Conditionally execute a command.
  • ifdown : Bring a network interface up or down (same as 'ifup').
  • import : Capture a portion of an X server screen.
  • install : Copy files and set attributes.
  • ip : Show and set routing, devices and tunnels.
  • jobs : Lists the active jobs.
  • join : Use to join lines (from files or STDIN).
  • kill : Kill a process by supplying its PID.
  • killall : Kill a process by supplying its name.
  • less : Format output to print one screen at a time for easier reading.
  • link : Create a symbolic link to a file.
  • local : Declare and set a variable within a function that has local scope.
  • logname : Display the name of the currently logged in user.
  • look : Display any lines prefixed by [string].
  • lprint : Print a file.
  • lprintd : Abort a print job.
  • lprintq : List the print queue.
  • ls : Lists the contents of a directory.
  • lsof : Lists all open files.
  • make : Used for recompiling a group of programs.
  • man : Opens a manual page.
  • mkdir : Creates a new directory.
  • mkfifo : For creating a FIFO file.
  • mount : Used to mount a filesystem.
  • mtr : Network diagnostics including traceroute and ping.
  • mv : For moving or renaming files and directories.
  • mmv : Mass move and rename.
  • netcat : Read and write across networks; scan server responses / headers.
  • netstat : To view networking information.
  • nice : Run a command with adjusted scheduling priority.
  • nl : Write a file with numbered lines.
  • nohup : Run a command with hangup immunity.
  • notify-send : Program to send a desktop notification.
  • nslookup : Used to query internet nameservers.
  • open : Open a file in its default application.
  • op : Control user access to certain root applications.
  • passwd : Updates a user password.
  • ping : Test a network connection.
  • pkill : Kill a process by supplying a full or partial name.
  • popd : Use to traverse back down a path.
  • pr : Prepare files for printing.
  • printf : Format and print data.
  • ps : Process status.
  • pwd : Print the working directory.
  • quota : Reports disk usage and limits.
  • ram : Access RAM in raw mode.
  • rar : For compressing and archiving files.
  • rcp : Use to remotely copy files between two machines.
  • readarray : Read from STDIN into an array variable.
  • readonly : Specify a variable or function as read only.
  • reboot : Reboot the system.
  • rename : Use for partial renaming of files. Not a Bash builtin module.
  • return : To exit a shell function.
  • rm : For removing a file.
  • rmdir : For removing directories.
  • rsync : Remote file copy.
  • screen : Multiplex a terminal across several processes.
  • scp : Securely copy remote files.
  • sdiff : Use to merge two files interactively.
  • sed : Stream editor for basic text transformation.
  • select : Select [value] in [words].
  • seq : Output a sequence of numbers with an optional step.
  • set : Set or unset shell variables.
  • sftp : SFTP program.
  • shift : Shifts parameters to the left.
  • shopt : Set on unset shell options, such as 'checkwinsize', etc.
  • shutdown : Shutdown or restart the machine.
  • sleep : Pause or delay for a specified time.
  • slocate : Restricted (and secure) file searching.
  • sort : Sort, merge or compare lines from input.
  • source : Also the dot operator, will read and execute commands from a file within the current shell context.
  • split : Split an input into fixed size pieces.
  • ssh : Open a secure shell client to login and execute commands on a remote machine.
  • stat : Displays file or file system status.
  • strace : Traces system calls or status.
  • su : Substitute user identity.
  • sudo : To execute a command as another user.
  • sum : Calculate a checksum, but prefer 'cksum'.
  • suspend : Suspends the shell and awaits SIGCONT.
  • sync : Write any buffered data in memory to disk.
  • tail : Selectively output the last part of a file.
  • tar : Add to, list or extract files in an archive.
  • tee : Redirect output to multpile files (useful for saving a copy of commands / responses).
  • test : Evaluate a conditional expression.
  • time : Loads a utility to measure the running time of another program.
  • timeout : Run a command with an exit time limit.
  • times : Will output both the user and shell time.
  • touch : Strictly, change the stamptime of a file. Generally, create a new file.
  • top : Find & view CPU intensive processes running on the system.
  • tput : Set terminal dependant capabilities, eg. color, position.
  • traceroute : Print the route packets take to a network host.
  • trap : Run a command once a signal is set.
  • tr : Translate, squeeze and delete characters from the input.
  • true : Gives true (exit status 0), though the ':' colon command will do this faster. In essence, do nothing successfully.
  • tsort : Performs a topological sort from a file or STDIN.
  • tty : Print the name of the terminal connected to STDIN.
  • type : Describe a command for a name.
  • ulimit : Limit a user's access to system resources.
  • umask : Can be used to automatically set file permissions on newly created files.
  • umount : Unmount a drive or device.
  • unalias : Unset a command alias.
  • uname : Print system information.
  • units : Convert units from one scale to another.
  • unrar : Extract uints from a .rar archive.
  • unset : Remove variable or function names.
  • unshar : Unpack a shell archive script.
  • until : Conditionally execute commands.
  • uptime : Report uptime.
  • useradd : Create a new user or update default information.
  • userdel : Delete a user account and associated files.
  • usermod : Modify user account information.
  • users : Prints a list of the currently logged in users.
  • uuencode : Encode a binary file for transmission over networks that only support it.
  • uudecode : Decode a file encoded with 'uuencode'.
  • vdir : Verbosely list directory contents, prefer 'ls -la' for more detail.
  • vi : Launch the visual editor (http://ss64.com/vi.html).
  • vmstat : Reports statistics on virtual memory usage and overheads.
  • wait : Wait for the specified processes to terminate and return their exit status.
  • watch : Execute (and display) a program periodically.
  • wc : Display line, word and byte counts.
  • whereis : Search for a program in $PATH and standard install directories.
  • which : Search $PATH for a program file.
  • while : Conditionally execute commands.
  • who : Print the users currently logged in.
  • whoami : Print the information of the current user.
  • wget : Retrieve a file via HTTP, HTTPS or FTP.
  • write : Used to send a message to another user.
  • xargs : Execute a command passing a constructed argument list.
  • xdg-open : Open a file or URL in the user's preferred program.
  • xz : Will compress or decompress .xz or .lzma files.
  • zip : Package and compress archive files.

While this list is extensive it is not exhaustive.
All commands will have modifier flags available, for a comprehensive list on those details see : http://ss64.com/bash/

About

A Reminder Of The Most Useful Bash Commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published