A guide to Ubuntu Linux Terminal Commands for your Dell PC

Summary: A guide to various Ubuntu Linux Terminal commands explained.

Article Content


Symptoms

 


This article provides information about the terminal applications commands in Ubuntu Linux.


Table of Contents:

  1. Basic Control Commands
  2. Basic User and System Commands
  3. Basic Drives and Rights Commands
  4. Basic Network Commands

 

Basic Control Commands

 

Terminal Commands are instructions that you can use while in the Ubuntu terminal application to accomplish any tasks on your system. I have subdivided the commands into smaller tables to make their uses clearer and to aid in using these articles as a reference point.

 
Command Effect Additional Info
cd Change Directory with this command you can navigate
through the system. simply typing
cd or cd~ will take you to the
home folder, which is the default
starting position in terminal.
cd/ Go to root directory.  
cd.. Up one directory level  
cd- Back to previous directory  
pwd Print working directory. this displays your location in the system.
bash GNU Bourne-again shell  
break Exit from a loop  
case Conditionally perform a command  
clear Clear terminal screen  
continue Resume the next iteration of a loop.  
cron Daemon to execute scheduled commands  
crontab Schedule a command to run at a later time  
echo Display message on screen  
enable Enable and disable builtin shell commands.  
env Environment Variables  
eval Evaluate several commands or arguments.  
expect Automate applications accessed over a terminal.  
export Set an environment variable.  
expr Evaluate expressions  
false Do nothing, unsuccessfully.  
for Expand words and execute commands.  
hash Remember the full pathname of a name argument.  
hostname Print or set system name.  
if Conditionally perform a command  
jobs List active jobs  
join Join lines on a common field.  
local Create variables  
logout Exit a login shell.  
more Display output one screen at a time.  
nice Set the priority of a command or job.  
nohup Run a command immune to hangups.  
notify-send Send desktop notifications.  
op Operator access  
readarray Read from stdin into an array variable  
readonly Mark variables/functions as read-only.  
reboot Reboot the system.  
return Exit a shell function.  
sed Stream editor  
select Accept keyboard input.  
set Manipulates shell variables and functions.  
shift Shift positional parameters.  
shopt shell options  
shutdown Shut down or restart Linux  
sleep Delay for a specified time  
ssh Secure shell client remote login program
suspend Suspend execution of this shell.  
sync Synchronize data on disk with memory.  
test Evaluate a conditional expression.  
trap Run a command when a signal is set.  
true Do nothing, successfully.  
type Describe a command.  
unshar Unpack shell scripts.  
until Execute commands until error
vmstat Report virtual memory statistics.  
watch Execute or display a program periodically.  
while Executes commands  
write Send a message to another user.  
xargs Execute utility, passing constructed argument lists  
### Allows you to remark/comment without disturbing the terminal  
while Executes commands  

Managing files and text are commands that directly affect the files and the text that is stored and used on your computer. The Dash and the Windows Explorer tool are well-known Graphical User Interface GUI versions of this tool.

 
Command Effect Additional Info
cp Copy allows you to copy a file, to do so add the name of the file you want to copy along with the command. as long as the file is located in the directory you have browsed to. otherwise type cp~/< file path > in order to specify where the file you wanted to copy is located.
ls List Lists all the files in current directory.
ls~ Lists files in the home directory adding a folder name shows a list of all the files in that specific folder. i.e. ls~/desktop will show you the files in the desktop folder.
mkdir Make directory allows you to create a directory. i.e. mkdir private files, will make a new directory called private files that are located in the home directory. Unless you browsed to another directory or specified another path.
mv Move you can rename or move a file with this command. if you want to rename the file sunny today, you may want to type mv sunny day. this requires that you have browsed to the correct directory or that you specified the correct file path. When type mv day ~/Desktop, the file day will be moved from home to Desktop. However, if you want to rename the file as well, as the new file name next to the current name in the command.
rm Remove simply removes a file, specify the file path/file name.
rmdir Remove directory removes an empty directory.
rm -r Remove recursively removes a directory along with its content.
grep Search for text strings  
head Display start of file  
less Display part of file  
tail Display end of file  
apropos Searches help manual pages.  
aspell Spell Checker  
awk Find and Replace text. database sort/validate/index.
cmp Compare two files.  
comm Compare two sorted files line by line.  
csplit Split a file into context-determined pieces.  
cut Divide a file into two separate pieces.  
cksum Print CRC checksum and byte counts  
find Search for files that meet set criteria  
fmt Format paragraph text  
fold Wrap text to specific width.  
dir Briefly list directory contents  
dircolors Color setup for ls  
dirname Convert a full pathname to a path.  
dirs Display a list of remembered directories.  
cat Display the contents of a file.  
bzip2 Compress or decompress named files.  
chroot Run a command with a different root directory.  
fgrep Search files for lines that match a fixed string  
fuser Identify/Kill the process that is accessing a file  
gawk Find and replace text within files.  
gzip Compress or decompress Name files.  
ln Makes links between files  
locate Find files  
look Display lines beginning with a given string.  
lpr Off line print  
lpc Line printer control program  
lprm Remove jobs from the print queue.  
lprint Print a file.  
lprintd Cancel a print job.  
lprintq List of the print queue  
lsof List open files  
vdir Verbosely list directory contents ls -| -b
v Verbosely list directory contents ls -| -b
vi Text editor  
uuencode Decode a file. decode a file using uuencode.
uuencode Encode a file. encode a file using uuencode.
tty Print filename of terminal on stdin  
touch Change file timestamps  
expand Convert tabs to spaces.  
import Capture an x server screen and save the image to file.  
install Copy files and set attributes  
fg Send job to foreground.  
bg Send job to background.  
nl Number lines and write files.  
open Open a file in its default application  
paste Merge lines of files.  
pathchk Check file name portability.  
popd Restore the previous value of the current directory.  
pr Prepare files for printing.  
printcap Printer capability database  
printenv Print environment variables  
printf Format and print data  
pushd Save and then change the current directory.  
rcp Copy files between two machines  
read Read a line from standard input.  
rename Rename files  
remsync Synchronize remote files via email.  
mmb Mass move and rename files.  
mtools Manipulate MS-DOS files.  
rev Reverse lines in a file  
rsync Remote copy a file synchronize files trees
sdiff Merge two files interactively.  
scp Secure copy  
sftp Secure file transfer program  
slocate Find file  
sort Sort text files  
split Split a file into fixed size pieces.  
sum Print a checksum for a file.  
tee Redirect output to multiple files  
tsort Topological sort  
unmask User file creation mask  
source Run commands from file.  
symlink Makes a new name for a file  
tr Translate, squeeze and/or delete.  
uniq Uniquify files  
wc Print byte, word, and line counts  
whereis Search the users $path, man pages and source files for a program.  
which Search the users $path for a program file.  
wget Retrieve web pages or files.  
unexpand Convert space to tabs.  
yes Print a string until interrupted.  
xdg-open Open a file or URL in the users preferred application.  
dmesg Print kernel and driver messages  


Back to Top


 

Basic User and System Commands

 

These commands enable you to manage, configure, troubleshoot, and reset the User and Group settings on your Ubuntu system.

 
Command Effect Additional Info
passwd Create a password.  
groupadd Add a group.  
groupmod Modify a group.  
chgrp Change group  
groupdel Delete group  
adduser Add a user to the system.  
addgroup Add a group to the system.  
alias Create an alias.  
useradd Create a new user account.  
usermod Modify user account.  
users List users currently logged in  
chmod Change access permissions  
chown Change file owner and group  
groups Print group names a user is in.  
id Print user and group ids  
logname Print current login name.  
su Substitute user identity  
times User and system times  
who Print all usernames currently logged in.  
whoami Print the current user id and name. id -un

The commands below deal with system-specific programs and information.

 
Command Effect Additional Info
cal Calendar display a calendar
date Date display the date
dc Desk Calculator Calculator
fsck File System Check  
bc Arbitrary precision calculator language  
kill  Stop a process from running.  
killall Kill processes by name.  
let Perform arithmetic on shell variables.  
make Recompile a group of programs.  
pkill Stop processes from running.  
ps Process status  
seq Print numeric sequences.  
units Convert units from one scale to another.  

Packages are the Ubuntu default method of loading and updating new applications and files. These commands allow for management and configuration of the packages downloaded.

 
Command Effect Additional Info
apt -get Search for and Install software packages  
aptitude Search for and Install software packages  
apt -get update Refresh available updates.  
apt - get upgrade Upgrade all packages.  
apt -get dist-upgrade Upgrade with package replacements Upgrade Ubuntu Version
apt -get install pkgname Install package by name.  
apt -get purge pkgname Uninstall package by name.  
apt -get autoremove Remove obsolete packages.  
apt -get -f install Try to fix broken packages.  
dpkg -configure -a Try to fix broken packages.  
dpkg -i pkg.deb Install file pkg.deb  

These commands give you a direct way to manage the services on your Ubuntu system.

 
Command Effect Additional Info
start service Start job service. Upstart
stop service Stop job service. Upstart
status service Check if service is running. Upstart
/etc/init.d/service start Start service SysV
/etc/init.d/service stop Stop service SysV
/etc/init.d/service restart Restart service Sysv
/etc/init.d/service check Check service SysV
runlevel Get current runlevel.  


Back to Top


 

Basic Drives and Rights Commands

 

Managing the drives and formats simply means that you can affect the peripherals that are attached to your system. Whether these be multiple Hard disk drives, removable media or other devices. They allow you to manage and configure these devices at the command-line level.

 
Command Effect Additional Info
mount Mount a drive.  
unmount Unmount a drive.  
fdisk Format disk  
cfdisk Partition table editor for Linux  
dd Duplicate disk convert and copy a file, write
disk headers, boot records,
ddrescue Data recovery tool  
declare Declare variables and assign attributes.  
df Disk free space displays how much disk space on
every mounted partition that is
occupied. df uses MB and GB instead
of blocks.
du Directory usage displays how much space a given
directory plus all of it's
subdirectories uses.
du -s Directory usage summary  
du -h Directory usage basic info this translates the information into
a basic nontech format.
free How much free space is available. this tells you how much free space
is available for use.
free -m Shows free space statistics shows the statistics in MB.
uname -a Get all kernel information.  
uname -r Get kernel information.  
lsb_release -a Prints information about your Linux distro  
top Start system monitoring this initiates monitoring, viewing RAM,
CPU and swap usage, plus the
total running processes.
q Stop system monitoring.  
diff Display difference between 2 files  
diff3 Display difference between 3 files  
 
SLN265879_en_US__1icon Note: Most of the following commands will need to be prefaced with the sudo command. This elevates privileges to the root-user administrative level temporarily. Which is necessary when working with directories or files that are not owned by your user account. When using sudo, you will be prompted for your password. Only users with sudo (administrative) privileges can use this command.
 
Command Effect Additional Info
history List of all commands user the history command shows a very long list
of commands that you have typed. each
command is displayed next to a number. you
can type | x to execute a previously
typed command from the list (replace the X
with a number). if your history output
is too long, then use history | less
for a scrollable list.
REISUB Reboot system hold down both the ALT and PRINTSCRN keys while
typing this to restart the computer.
apt -get Application used to install, removed, upgrade, and more.
file Type checking of one or more files.  
sleep Delay commands wait x seconds to continue with the next command.
pidof Get PID PID given in readable format
ps System monitor for command line also good for scripts.
cat Print file in command line.  
crontab Time drive events  
man Help manual open the manual of programs, displays
the command manual.
man man Manual about Manual help page about using help page.
man intro Brief list of commands when you need information about a command
, type < command name >-h or < command name
 >--help
, if the first rule did not work. You
see that some command lines may not associate -h
with --help.
info info Introduction to info pages  
basename Strip directory and suffix from filenames  
eject Eject removable media.  
fdformat Low-level format format an FD floppy disk.
mkisofs Create a hybrid filesystem.  
format Format disks or tapes  
mknod Make block or character special files.  
quotactl Set disk quotas  
quotacheck Scan a file system for disk usage.  
quota Display disk usage and limits  
tar Tape archiver  
ram RAM disk device  

The rights to files and directories and the ability to change them are required at an administrator level. These can be used to change or repair existing files or to stop other files or directories from being damaged by inexperienced users.

 
Command Effect Additional Info
chmod Change Mode  
su Switch User  
ulimit Limit user resources  
unalias Remove an alias.  
unset Remove variable or function names.  
function Define Function macros.  

Elevated privileges are what Ubuntu calls Administrator Rights. You must run these commands when you need to change things on your system at a high enough level. The windows equivalent would be opening a command prompt as an administrator.

 
Command Effect Additional Info
sudo Elevated privileges executing commands with elevated privileges
- < superuser do >; a common expression which
indicates that the taken action must
be verified with the admin password.
sudo -r Open root shell as user  
sudo -r -u Open shell as user  
sudo -k Forget sudo passwords.  


Back to Top


 

Basic Network Commands

 

These commands deal with configuring and troubleshooting Network connections on your system. This includes wired and wireless connections.

 
Command Effect Additional Info
chkconfig Check activated services.  
ping Test network connections  
ftp File Transfer Protocol  
host Check IP of Domain.  
ifconfig Configure network devices.  
iwconfig Show wireless information.  
sudo iwlist scan Scan for wireless networks  
ifup eth0 Bring interface eth0 online.  
ifdown eth0 Display the eth0 interface.  
netstat Display routing table  
route Set routes  
telnet Connect to Telnet.  
traceroute Display route  
dig DNS lookup  
ethtool Ethernet card settings  
mkfifo Make FIFOs named pipes
mtr Network diagnostics traceroute/ping
nslookup Query Internet name servers interactively  
screen Multiplex terminal run remote shells via ssh
strace Trace system calls and signals  

These commands deal with the Ubuntu firewall management and configuration.

 
Command Effect Additional Info
ufw enable Turn on firewall.  
ufw disable Turn off firewall.  
ufw default allow Allow all connections by default.  
ufw default deny Deny all connections by default.  
ufw status Cyrrebt status and rules  
ufw allow port Allow traffic on port.  
ufw deny port Deny traffic on port.  
ufw deny from ip Block IP Address  


Back to Top


 

Additional Information:

 

SLN265879_en_US__1icon Note:
Software support is by Canonical through the following methods:
Technical Support is provided by Dell:


Back to Top


Article Properties


Affected Product

Inspiron, Latitude, Vostro, XPS, Fixed Workstations

Last Published Date

21 Feb 2021

Version

3

Article Type

Solution

Rate This Article


Accurate
Useful
Easy to Understand
Was this article helpful?

0/3000 characters