Linux For Dummies
Book image
Explore Book Buy On Amazon
Linux can seem like a very daunting environment. But it doesn’t have to be! With the two topics in this cheat sheet—the commands you’ll use on a daily basis and the useful help pages—you can easily navigate your Linux environment.


Linux Commands

Although you can do most things in Linux these days by pointing and clicking, you still may want to try using Linux at the command prompt. This table shows you the commands that help you navigate your Linux system using only your keyboard.

Command Description
cat [filename] Display file’s contents to the standard output device (usually your monitor).
cd /directorypath Change to directory.
chmod [options] mode filename Change a file’s permissions.
chown [options] filename Change who owns a file.
clear Clear a command line screen/window for a fresh start.
cp [options] source destination Copy files and directories.
date [options] Display or set the system date and time.
df [options] Display used and available disk space.
du [options] Show how much space each file takes up.
file [options] filename Determine what type of data is within a file.
find [pathname] [expression] Search for files matching a provided pattern.
grep [options] pattern [filesname] Search files or output for a particular pattern.
kill [options] pid Stop a process. If the process refuses to stop, use kill -9 pid.
less [options] [filename] View the contents of a file one page at a time.
ln [options] source [destination] Create a shortcut.
locate filename Search a copy of your filesystem made at around 3am for the specified filename.
lpr [options] Send a print job.
ls [options] List directory contents.
man [command] Display the help information for the specified command.
mkdir [options] directory Create a new directory.
mv [options] source destination Rename or move file(s) or directories.
passwd [name [password]] Change the password or allow (for the system administrator) to change any password.
ps [options] Display a snapshot of the currently running processes.
pwd Display the pathname for the current directory.
rm [options] directory Remove (delete) file(s) and/or directories.
rmdir [options] directory Delete empty directories.
ssh [options] user@machine Remotely log in to another Linux machine, over the network. Leave an ssh session by typing exit.
su [options] [user [arguments]] Switch to another user account.
tail [options] [filename] Display the last n lines of a file (the default is 10).
tar [options] filename Store and extract files from a tarfile (.tar) or tarball (.tar.gz or .tgz).
top Displays the resources being used on your system. Press q to exit.
touch filename Create an empty file with the specified name.
who [options] Display who is logged on.

To access your CDs/DVDs:

  • If you’re in the GUI, the media should be automatically detected.
  • On the command line, look in the /media You may need to use mount /media/cdrom, /media/dvdrom, or some other variant.

To remove your CDs/DVDs:

  • In the GNOME 3 desktop, right-click the CD icon and choose Eject. If you’re using the KDE Plasma desktop, select the Device Notifier icon in the Panel, then select the CD icon to eject.
  • On the command line, type umount /media/cdrom, where you should change cdrom to whatever you had to use to mount the item.

Linux Help Pages

To find help in Linux, try

  • man -k [keyword]: Search a database for commands that involve the keyword. Can also be used as apropos [keyword].
  • info [command]: Display a file’s help information in an alternate format.
  • man [command]: Display a file’s help information.
  • whatis [command]: Display a short blurb about the command.
  • openSUSE: The openSUSE documentation provides a complete reference guide to both the openSUSE environment, and the GNOME 3 desktop environment. There’s also a user forum where users can post and answer specific questions about using openSUSE.
  • Ubuntu: The official Ubuntu documentation provides basic information on how to get started with most common desktop tasks. Just look for the topic area you’re interested in and follow the thread. Ubuntu also has a wiki website, where Ubuntu users can contribute their own guides and tutorials.

About This Article

This article is from the book:

About the book author:

Richard Blum has more than 30 years of experience as a systems administrator and programmer. He teaches online courses in PHP, JavaScript, HTML5, and CSS3 programming, and authored the latest edition of Linux For Dummies.

This article can be found in the category: