Tag Archives: fg n

Linux Command Line Quick Reference

Note: most commands will require the use of a proceeding su or sudo command to give you Super User privileges. Also referred to as substitute user or switch user.

System Information

date – Display current date and time.
cal – Display the current months calendar.
uptime – Display how long your system has been running.
w – Display who is currently online.
whoami – Display who you are logged in as.
finger user – Display information about the user
uname -a – Display Kernel information. (See Linux: How To Identify The Linux Kernel Version?)
cat /proc/cpuinfo – Display CPU Information.
cat /proc/meminfo – Display memory information.
man command – Display the manual page for a given command.
df -h – Display Disk Usage.
du – Display directory space usage.
free – Display memory and swap usage.
whereis appname – Display potential location of application.
which appname – Display which application will run by default.


ping host – Ping hostname or IP address and display results.
whois domain – Display whois record information for domain.
dig domain – Display DNS information for domain.
dig -x host – Display the reverse lookup of the host.
wget filename – Download a file via url.
wget -c filename – Continue downloading a stopped download.


ps – Display all current active processes.
top – Display all current running processes.
kill pid – Kill process with id pid.
killall proc – Kill all processes named proc (Be careful!).
bg – Display all stopped or background jobs.
fg – Bring the most recent job to the foreground.
fg  n – Bring job n to the foreground.

Software Installation

Install software from source. Change to directory (cd) containing source files and execute the following commands:

make install

Install Software Debian Package Manager:
su dpkg -i pkgname.deb

Install Software RedHat Package Manager:
su rpm -Uvh pkgname.rpm

Install Software Ubuntu apt:
sudo apt-get install pkgname

Working With Files

ls – Display directory listing.
ls -al – Display directory listing, formatted and show hidden files.
cd dir – Change directory to dir.
cd ~ – Change directory to the home directory.
pwd – Display the current present working directory.
mkdir dir – Create a new directory named dir.
rm filename – Delete file filename.
rm -r dir – Delete directory dir.
rm -f filename – Force delete of file filename.
rm -rf dir Force delete of directory dir.(Be Careful!).
cp file1 file2 – Copy file1 to file2.
cp -r dir1 dir2 – Copy dir1 to dir2 (create dir2 if non existent)
mv file1 file2 –  Move or rename file1 to file2.
ln -s file link – Create a symbolic link from link to file.
touch filename – Create file filename or update.
cat > file – Sends standard input to file.
more file – Display contents of file.
head file – Display first 10 lines of file.
tail file – Display last 10 lines of file.
tail -f file – Display contents of file as it gets bigger starting with last 10 lines.

Searching Files

grep pattern files – Search for a pattern in files.
grep -r pattern dir – Search recursively for a pattern in dir.
command | grep pattern – Search for a pattern in the output of a command.
locate file – Find all instances of file.

File Permissions

chmod octal file – Change the permissions of file to octal (user|group|world):

4 – read (r)
2 – write(w)
1 – execute(x)
chmod 777 file – Changes the permissions of file to read, write and execute for all users.
chmod 700 file – Changes the permissions of file to read, write and execute for user only.

File Compression

tar cf file.tar files – Create a tar named file.tar containing files.
tar xf file.tar – Extract the files from file.tar.
tar czf file.tar.gz files – Create a tar with Gzip compression.
tar xzf file.tar.gz – Extract a tar with Gzip.
tar cjf file.tar.bz2 – Create a tar with Bzip2 compression.
tar xjf file.tar.bz2 – Extract a tar with Bzip2.
gzip file – Compress file and rename to file.gz.
gzip -d file.gz – Decompress file.gz back into file.


ssh username@host – Connect to a host as a specific username.
ssh -p port username@host – Connect to a host on a specific port as a specific username.
ssh-copy-id username@host – Add your key to host for username to enable a passwordless login.

Terminal Shortcuts

Ctrl+C – Halts the current command.
Ctrl+Z – Stops the current command, resume with fg in the foreground or bg in the background.
Ctrl+D – Logout of current session.
Ctrl+W – Erases one word in the current line.
Ctrl+U – Erases the whole line.
Ctrl+R – Type to bring up a recent command.
!! – Repeats the last command.
UpArrow – Cycles through all commands previously used in current session.
exit – Log out of current session.