0% found this document useful (0 votes)
13 views4 pages

Linux Commands

The document provides a guide to basic Linux commands, detailing their functions and usage examples. Key commands include 'man' for manuals, 'ls' for listing files, 'cd' for changing directories, and 'shutdown' for system shutdowns. Additional commands cover file manipulation, user permissions, network configuration, and package management.

Uploaded by

john.b.webb4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views4 pages

Linux Commands

The document provides a guide to basic Linux commands, detailing their functions and usage examples. Key commands include 'man' for manuals, 'ls' for listing files, 'cd' for changing directories, and 'shutdown' for system shutdowns. Additional commands cover file manipulation, user permissions, network configuration, and package management.

Uploaded by

john.b.webb4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Basic Linux Commands - The A+ Survival Guide

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

This would show the contents of the bin folder.

grep - The grep command - Use to search files for strings of characters, and displays the matching lines
from those files.

Example: grep “Find me.” myfile.txt

This would search myfile.txt for every line that includes the exact string, “Find me.”

cd - The change directory command - Allows you to navigate between directories.

Example: cd/etc/shadow - This would move you to the shadow folder.

shutdown - The shutdown command - Allows you to bring the system down.

Example: shutdown 20:00

This would tell the system to shut down at 8 PM.

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.

Example: mv myfile.txt /home/shared/shared.txt

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

Example: cp myfile.txt /home/shared

This would copy myfile.txt and place the copy in the /home/shared directory.

rm - The remove command - Use to remove (delete) files or directories.

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).

Example: chmod u=rwx,g-rx,o=r myfile.txt

This would set the listed permissions on myfile.txt

chown - The change owner command - Use to set/change the owner of a file or directory.

Example: chown root /shareddocuments

This would change the owner of the shareddocuments folder to root.


ifconfig - The interface configuration command - Use to view/change the configuration of the network
interfaces on your system.

Example: ifconfig

This would display information about all operational network interfaces.

iwconfig - The wireless interface configuration command - Use to view/change the configuration of
wireless network interfaces on your system.

Example: iwconfig wlan0 mode Ad-Hoc

This would configure interface wlan0 to connect in Ad-Hoc mode.

ps - The process command - Use to view a list of the current processes.

Example: ps ax

Example: ps -ef

These commands will give a full list of processes.

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.

Example: sudu -u root ./setup.sh

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.

Example: sudu apt-get install chromium

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

• Insert mode in which entered text is inserted into the file.

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

This would open MyFile.txt in the vi editor.

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.

Example: dd if=/dev/sda of=~/disk1.img

This would create a file, disk1.img file of the contents of the /dev/sda hard drive.

You might also like