linux commands Flashcards
(21 cards)
man
An online manual
> man grep
ls
List directory contents
– Similar to the dir command in Windows
pwd
Print Working Directory
– Displays the current working directory path
– Useful when changing directories often
mv
Move a file or rename a file
mv SOURCE DEST
> mv first.txt second.txt
cp
Copy a file - Duplicate files or directories
cp SOURCE DEST
> cp first.txt second.txt
rm
Remove files or directories - Deletes the files
Does not remove directories by default
– Directories must be empty to be removed or
must be removed with -r
chown
Change file owner and group - Modify file settings
sudo chown [OWNER:GROUP] file
> sudo chown professor script.sh
sudo
– Execute a command as the super user or user ID
– Only that command executes as the super user
su
– Become super user or change to a different user
– You continue to be that user until you exit
chmod
Change mode of a file system object
– r=read, w=write, x=execute
– Can also use octal notation
– Set for the file owner (u), the group(g),
others(o), or all(a)
apt-get
Advanced Packaging Tool
– Handles the management of application packages
– Applications and utilities
* Install, update, remove
> sudo apt-get install wireshark
yum
Yellowdog Updater, Modified (yum) -
Install, delete, update
Manages RPM packages
– Red Hat Package Manager - RPM Package Manager
– A Linux distribution will commonly use either
yum or apt-get
ip
Manage the network interfaces
– Enable, disable, configure addresses,
manage routes, ARP cache, etc.
* ip address
– View interface addresses
* ip route
– View the IP routing table
* sudo ip address add 192.168.121.241/24 dev eth0
– Configure the IP address of an interface
df
Disk Free - View file systems and free space
* df
– View number of blocks
* df -h
– View human-readable sizes
grep
Find text in a file
– Search through many files at a time
grep PATTERN [FILE]
> grep failed auth.log
ps
View the current processes
– And the process ID (PID)
– Similar to the Windows Task Manager
View user processes
ps
View all processes
ps -e | more
top
View CPU, RAM, and resource utilizations
– The “Task Manager” for Linux
Process information
– Easy to find the highly utilized applications
Summary of overall load
– One, five, and fifteen minutes
Many different options
– Check the man page for startup options and keys
find
Find a file by name or extension
– Search through any or all directories
Find files with a specific extension
> find . -name “*.txt”
dig
Lookup information from DNS servers
– Canonical names, IP addresses, cache timers, etc.
dig (Domain Information Groper)
– Detailed domain information
cat
Concatenate - Link together in a series
Copy a file/files to the screen
cat file1.txt file2.txt
Copy a file/files to another file
cat file1.txt file2.txt > both.txt
nano
Full-screen text editor - Easy to edit
Included with many Linux distributions - Easy to install
Select, mark, copy/cut, and paste text
– Similar features to graphical-based editors