Basic Linux Commands Flashcards
ls - List directory contents - Basic Linux Commands
• Lists files, directories
• For long output, pipe through more: > ls -l | more
(use q or Ctrl-c to exit)
grep - Find a text in a file - Basic Linux Commands
- grep PATTERN [FILE]
* > grep failed auth.log
cd - Change current directory - Basic Linux Commands
- Nearly identical to Windows command line
- Forward slashes instead of backward
- cd
- > cd /var/log
shutdown - Shut the system down - Basic Linux Commands
- sudo shutdown 2
- Shuts down and turns o the computer in two minutes
- sudo shutdown -r 2
- Shuts down and reboots in two minutes
- Ctrl-C to cancel
pwd - Print Working Directory - Basic Linux Commands
- Displays the current working directory path
* Useful when changing directories often
passwd - Change a user account password - Basic Linux Commands
• passwd [username]
mv - Move (rename) a file - Basic Linux Commands
- mv SOURCE DEST
* > mv first.txt second.txt
cp - Copy a file - Basic Linux Commands
- cp SOURCE DEST
* > cp rst.txt second.txt
rm - Remove files or directories - Basic Linux Commands
- Does not remove directories by default
* Directories must be empty or must be removed with -r
mkdir - Make a directory - Basic Linux Commands
- mkdir DIRECTORY
* > mkdir notes
chmod - Change mode of a file system object - Basic Linux Commands
- 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)
- chmod mode FILE
- > chmod 744 script.sh
chown - Change file owner and group - Basic Linux Commands
- sudo chown [OWNER:GROUP] file
* > sudo chown professor script.sh
iwconfig - View or change wireless network configuration - Basic Linux Commands
- Requires some knowledge of the wireless network
* iwconfig eth0 essid studio-wireless
ifconfig - View or configure a interface and IP configuration - Basic Linux Commands
•ifconfig eth0
ps - View the current process - Basic Linux Commands
- Similar to the Windows Task Manager
- View user processes - ps
- View all processes - ps -e | more