-
Notifications
You must be signed in to change notification settings - Fork 1
Basic UNIX and bash commands
Jennings Zhang edited this page Mar 22, 2018
·
15 revisions
CAPITAL LETTERS describe a required argument.
[square brackets] indicate optional parameters, flags, or options.
The basic command syntax looks like this:
command --option PARAMETER
-
echo [string]outputs the string. -
ls [-alh] [dir]displays the contents of the directoryDIR.-
ls -alists all files, including.and.., as well as hidden files (which filenames begin with.). -
ls -llists files with metadata, such as permissions, owner, size, and date.-
ls -lhreports the information in "human readable" format.
-
-
-
cd DIRchanges the current working directory toDIR. -
mkdir DIRcreates a new directory. -
rmdir DIRdeletes an empty directory. -
rm FILEdeletes a file. (accepts multiple arguments) -
touch FILEcreates a blank file calledFILE. -
catconcatenates the input stream and prints to the output stream.-
cat FILEprints the content ofFILE -
cat > FILEwill write the standard input stream out toFILE. End this command by pressing CTRL-D.
-
-
man COMMANDshows the manual page forCOMMAND. -
whatis COMMANDshows a brief, one-line description ofCOMMAND. -
sudo COMMANDrunsCOMMANDwith superuser (root) privileges. -
grep REGEX [file]filters the input stream or file based on a regular expression.-
fgreporgrep -Fforces literal evaluation of string. - I strongly recommend you add
alias grep='grep --color'to your~/.bashrcfile.
-
-
nano [file]opens an easy-to-use text-based text editor. -
vim [file]opens an advanced text-based text editor. -
ln -s TARGET LINKNAMEcreates a symbolic link. -
sudo -senters$SHELLas the root user. -
sudoedit FILEedits a file as the root user. ($SUDO_EDITORmust be set, recommendrvim) -
dmesg [-H]print the kernel ring buffer (debug messages produced by the kernel) -
journalctl -b [-r]shows systemd log entries from the current boot.