GNU Core Utilities
The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems.
— Wikipedia
Here I store basic coreutils and similar tools that I use on a daily basis. A lot of these commands also usually exist in this Unix commands list.
Source code of coreutils can be found at gnu.org website: coreutils.git
- write flashcards
File utilities
chcon- Changes file security context (SELinux)chgrp- Changes file group ownershipchown- Changes file ownershipchmod- Changes the permissions of a file or directorycp- Copies a file or directorydd- Copies and converts a filedf- Shows disk free space on file systemsdir- Is exactly like “ls -C -b”. (Files are by default listed in columns and sorted vertically.)dircolors- Set up color for lsinstall- Copies files and set attributesln- Creates a link to a file- ls - Lists the files in a directory
mkdir- Creates a directorymkfifo- Makes named pipes (FIFOs)mknod- Makes block or character special filesmktemp- Creates a temporary file or directorymv- Moves files or rename filesrealpath- Returns the resolved absolute or relative path for a filerm- Removes (deletes) files, directories, device nodes and symbolic linksrmdir- Removes empty directoriesshred- Overwrites a file to hide its contents, and optionally deletes itsync- Flushes file system bufferstouch- Changes file timestamps; creates filetruncate- Shrink or extend the size of a file to the specified sizevdir- Is exactly like “ls -l -b”. (Files are by default listed in long format.)
Text utilities
b2sum- Computes and checks BLAKE2b message digestbase32- Encodes or decodes Base32, and prints result to standard outputbase64- Encodes or decodes Base64, and prints result to standard outputcat- Concatenates and prints files on the standard outputcksum- Checksums (IEEE Ethernet CRC-32) and count the bytes in a file.- Supersedes other sum utilities with
-aoption from version 9.0. comm- Compares two sorted files line by linecsplit- Splits a file into sections determined by context linescut- Removes sections from each line of filesexpand- Converts tabs to spacesfmt- Simple optimal text formatterfold- Wraps each input line to fit in specified widthhead- Outputs the first part of filesjoin- Joins lines of two files on a common fieldmd5sum- Computes and checks MD5 message digestnl- Numbers lines of filesnumfmt- Reformat numbersod- Dumps files in octal and other formatspaste- Merges lines of filesptx- Produces a permuted index of file contentspr- Converts text files for printingsha1sum,sha224sum,sha256sum,sha384sum,sha512sum- Computes and- checks SHA-1/SHA-2 message digests
shuf- generate random permutationssort- sort lines of text filessplit- Splits a file into piecessum- Checksums and counts the blocks in a filetac- Concatenates and prints files in reverse order line by linetail- Outputs the last part of filestr- Translates or deletes characterstsort- Performs a topological sortunexpand- Converts spaces to tabsuniq- Removes duplicate lines from a sorted filewc- Prints the number of bytes, words, and lines in files
Shell utilities
arch- Prints machine hardware name (same as uname -m)basename- Removes the path prefix from a given pathnamechroot- Changes the root directorydate- Prints or sets the system date and time- Prints the date and time in UTC:
date -u
- Prints the date and time in UTC:
dirname- Strips non-directory suffix from file namedu- Shows disk usage on file systemsecho- Displays a specified line of textenv- Displays and modifies environment variablesexpr- Evaluates expressionsfactor- Factors numbersfalse- Does nothing, but exits unsuccessfullygroups- Prints the groups of which the user is a memberhostid- Prints the numeric identifier for the current hostid- Prints real or effective UID and GIDlink- Creates a link to a filelogname- Print the user’s login namenice- Modifies scheduling prioritynohup- Allows a command to continue running after logging outnproc- Queries the number of (active) processorspathchk- Checks whether file names are valid or portablepinky- A lightweight version of fingerprintenv- Prints environment variablesprintf- Formats and prints datapwd- Prints the current working directoryreadlink- Displays value of a symbolic link, very useful to copy file path- The
realpathcommand without options, operates likereadlinkincanonicalizemode. - Get the actual file to which symlink points:
readlink path/to/file/ - Get absolute path of file:
readlink -f/--canonicalize path/to/file/
- The
runcon- Run command with specified security contextseq- Prints a sequence of numberssleep- Delays for a specified amount of timestat- Returns data about an inodestdbuf- Controls buffering for commands that use stdiostty- Changes and prints terminal line settingstee- Sends output to multiple filestest- Evaluates an expressiontimeout- Run a command with a time limittrue- Does nothing, but exits successfullytty- Prints terminal nameuname- Prints system informationunlink- Removes the specified file using the unlink functionuptime- Tells how long the system has been runningusers- Prints the user names of users currently logged into the current hostwho- Prints a list of all users currently logged inwhoami- Prints the effective useridyes- Prints a string repeatedly
Other Utilities
[- A synonym for test; this program permits expressions like [ expression ].
GNU binutils
The GNU Binary Utilities, or binutils, are a set of programming tools for creating and managing binary programs, object files, libraries, profile data, and assembly source code.
— Wikipedia
as- assembler popularly known as GAS (GNU Assembler)ld- linkergprof- profileraddr2line- convert address to file and linear- create, modify, and extract from archivesc++filt- demangling filter for C++ symbolsdlltool- creation of Windows dynamic-link librariesgold- alternative linker for ELF filesnlmconv- object file conversion to a NetWare Loadable Modulenm- list symbols exported by object fileobjcopy- copy object files, possibly making changesobjdump- dump information about object filesranlib- generate indices for archives (for compatibility; same asar -s)readelf- display content of ELF filessize- list total and section sizesstrings- list printable stringsstrip- remove symbols from an object filewindmc- generates Windows message resourceswindres- compiler for Windows resource files
Other
lsof (LiSt Open Files)
lsof is a command for LiSting Open Files. You can use lsof for example to:
- Find uses of a specific open file: lsof /path/to/file
- Find an unlinked open file: lsof +L1
- Find processes blocking umount: lsof /mnt
- Find tcp/udp sockets: lsof -i
- Find files open to a process with known PID: lsof -p 1234
- Find files open to a named command: lsof -c bash
- Find files open by a specific user: lsof -u somebody