Most viewed posts
Search
General
Linux Command: uname
uname [options]
Print information about the machine and operating system. Without options, print the name of the kernel (Linux).
uname -a Show kernel version and system architecture
Linux Command: tail
tail [options] [files]
Print the last 10 lines of each named file on standard output. Print from standard input with no filename or with -. If more than one
file is specified, the output includes a header at the beginning of each file:
==> filename <==
For options that take the number of bytes or lines as an argument, you can prepend a plus sign (+) to num to begin printing with the
numth item. These options can also specify a block size:
grep '\.Ah' file | tail -20 Show the last 20 lines containing instances of .Ah:
tail -f /var/log/messages Monitor messages in a log file
Linux Command: ls
ls [options] [names]
List contents of directories. If no names are given, list the files in the current directory. With one or more names, list files contained
in a directory name or that match a file name. names can include filename metacharacters. The options let you display a variety of
information in different formats. The most useful options include -F, -R, -l, and -s. Some options don’t make sense together (e.g., -u
and -c).
ls -lrt List files by date
ls /usr/bin | pr -T9 -W$COLUMNS Print in 9 columns to width of terminal
ls -lSr Show files by size, biggest last
Linux Command: hostname
hostname [option] [nameofhost]
Set or display name of current host system. A privileged user can set the hostname with the nameofhost argument.
hostname -i Lookup local ip address (equivalent to host `hostname`)
Linux Command: head
head [options] [files]
Print the first few lines (default is 10) of one or more files to standard output. If files is missing or -, read from standard input. With
more than one file, print a header for each file showing the filename.
head -20 phone_list Display the first 20 lines of phone_list:
head -n1 /etc/issue Show name and version of distribution
Linux Command: free
free [options]
Display statistics about memory usage: total free, used, physical, swap, shared, and buffers used by the kernel.
free -m Show amount of (remaining) RAM (-m displays in MB)
Linux Command: echo
echo [options] [string]
Send (echo) the input string to standard output. This is the /bin/ echo command. echo also exists as a command built into bash.
You may have to specify the full path to run /bin/echo instead of the shell built-in command.
echo $PATH | tr : '\n' Display the $PATH one per line
Linux Command: cat
cat [options] [files]
Read (concatenate) one or more files and print them on standard output. Read standard input if no files are specified or if - is specified
as one of the files; input ends with EOF. You can use the > operator to combine several files into a new file, or >> to append
files to an existing file. When appending to an existing file, use Ctrl-D, the end-of-file symbol, to end the session.
cat ch1 Display a file
cat ch1 ch2 ch3 > all Combine files
cat note5 >> notes Append to a file
cat > temp1 Create file at terminal. To exit, enter EOF Ctrl-D).
cat /proc/partitions Show all partitions registered on the system