List files (this have lots of command line switches (see them all with --help), check -l (extended), -t (date), -a (all, including hidden files) and -r (reverse order):
ls
Browse to directory:
cd <directory>
Show the content of a file in the screen (raw mode):
cat <file>
Show the content of a file in the screen with a pager (can use cursor keys and page up/down keys. Exit with q). This is like cat, but can go back and forth in the file:
less <file>
command | less # Reading content from the standard input.
Edit files:
mcedit <file> # Manage it the same way Norton-commander editor was managed (with F- keys).
vim <file> # This is a way more advanced editor. If you don't know how to exit press <ESCAPE> and type :q! and press <INTRO>
Create a directory:
mkdir <directory name>
Remove files:
rm -f file # Add the switch –r for directories
Disk usage:
df -m
Check a file/directory size (use -m for megabytes and -s to sum if a directory):
du
Server uptime (also provides the server load):
uptime
Get the current server date and time:
date
Get the server hostname (add the -f switch for the FQDN):
hostname
RAM usage:
free -m
Display the current path for commands:
echo $PATH
Check size of a given folder/file:
du -ms <file/folder>
Search for a file:
find <location> -name "filename" # This support POSIX REGEX.
Open the Midnight Commander file manager:
mc
Read the documentation of a given command:
man <command>
Elevate privileges with sudo:
sudo -i
Count (bytes (-c), chars (-m), words (-w) and lines (-l)):
wc –(switch) <file> # If file is not provided it reads from stdin.
Examples:
wc –l <file> # Count how many lines does file has
ps axf | wc –l # Count how many processes are running (+kthreads)
Filter outputs with grep:
grep <pattern> <file> # This support POSIX REGEX.
# If file is not provided it reads from stdin.
Examples:
grep "word" <file> # Check for the word text in file
ps axf | grep ccmexec # Check if the ccmexec process is running