Linux Commands
Linux Commands
man - The manual command - Shows the manual (help file) for the input command
Example: man cd
This would show the manual (help file) for the change directory command.
ls -
The list command - Use for viewing files, folders, and directories.
Example: Ls /bin
grep - The grep command - Use to search files for strings of characters, and displays the matching lines
from those files.
This would search myfile.txt for every line that includes the exact string, “Find me.”
shutdown - The shutdown command - Allows you to bring the system down.
pwd - The print working directory command - Allows you to view the full path to the current (working)
directory.
Example: pwd
This would tell the system to display the current working directory.
passwd - The password command - Use to change the password of a user account. Normal users may
change their own password. Administrators (using su or sudo) may change the password of another
user.
Example: passwd
This would tell the system you want to change the current user’s password. You will be prompted to
enter the current password, then the new password, and then you will be asked to verify the new
password.
mv - The move command - Use to move a file to another folder location. Can be used to rename files
when they are moved.
This would rename myfile.txt to shared.txt and move it to the /home/shared directory
cp - The copy command - Use to copy files and/or directories. Can also rename files
This would copy myfile.txt and place the copy in the /home/shared directory.
Example: rm /shareddocuments
This would remove (delete) the shareddocuments folder and all of its contents.
chmod - The change mode command - Use to set/change the permissions of files or directories.
Permissions may be read (r), write (w), or execute (x). Permissions are assigned to the user (u), the
user’s group (g), and others (o).
chown - The change owner command - Use to set/change the owner of a file or directory.
Example: ifconfig
iwconfig - The wireless interface configuration command - Use to view/change the configuration of
wireless network interfaces on your system.
Example: ps ax
Example: ps -ef
su - The substitute user (or super user) command - Change the active user ID for the current shell
session.
Example: su root
If the proper password is entered, this would change the active user context to root for the rest of the
session. All subsequent commands will be run as root.
sudo - The substitute user do (or super user do) command - Change the active user context for the
current shell session command.
If the proper password is entered, this would tell the system to run the setup.sh script using root access
(for example, to run the script in a location where only root may execute).
apt-get - The Advanced Packaging Tool - A (Debian/Ubuntu) command line tool for working with
software packages. Packages may be installed, modified, or removed. Most often, administrator
privileges are required, so apt-get is typically run using su or sudo.
This would (after providing the correct password for sudo) install the chromium browser package as
root.
vi - The vi editor - The vi editor is a full screen editor and has two modes of operation:
• Command mode commands which cause action to be taken on the file, and
In the command mode, every character typed is a command that does something to the text file being
edited; a character typed in the command mode may even cause the vi editor to enter the insert mode.
In the insert mode, every character typed is added to the text in the file; pressing the <Esc> (Escape) key
turns off the Insert mode.
Example: vi MyFile.txt
dd - The data duplicator command - Copies and file, converting the format of the data if directed to do
so by the parameters passed. “if” refers to the input file. “of” refers to the output file. It is commonly
used for backup operations.
Use this command with caution. Using the wrong parameters or values to wipe, overwrite, or destroy
the data on your storage media.
This would create a file, disk1.img file of the contents of the /dev/sda hard drive.