Basic Linux Commands Flashcards
1
Q
Linux Commands
A
- The Command Line
- Terminal , xTerm , or similar
- Commands are similar in both Linux & Mac OS
- Mac derived from BSD (Berkley Software Distro) Unix
- Use the “man” command for help
- An online manual
- > man grep
2
Q
SU / SUDO
A
-Some commands required elevated rights
- su
- Becomes super user
- Or change to a different user
- You continue as that user till you “exit”
- sudo
- Execute a command as the super user
- Or as a different user id
- Only that commands execute as a super user
3
Q
Is
A
- List directory contents
- Similar to the ‘dir’ command in Windows
- List files , directories
- May support color coding
-For long output pipe through more
Is-1 | more (by page) use 9 or ctrl-c to exit
4
Q
grep
A
- Find a text in a file
- Search through many files at a time
-grep PATTERN [file]
>grep failed auth.log
5
Q
cd
A
- Change current directory
- Nearly identical to Windows Command Line
- Forward slashes instead of backwards
-cd
>cd/var/log
6
Q
shutdown
A
- Shut the system down
- Safely turn off the computer in software
- Similar to the Windows shutdown command
- sudo shutdown 2
- shuts down & turn off the computer in 2min
- sudo shutdown - r2
- shuts down & reboots in 2min
-ctrl-c to cancel
7
Q
pwd vs passwd
A
- pwd
- Print Working Directory
- Display the current working directory path
- Useful when changing directories often
- passwd
- Change a user account password
- Yours or another
8
Q
mv
A
- Move a file
- Rename a file
-mv SOURCE DEST
>mv first.txt second.txt
9
Q
cp
A
- Copy a file
- Duplicate files or directories
-cp SOURCE DEST
>cp first.txt. second.txt
10
Q
rm
A
- Remove files or directories
- Deletes the files
-Does not remove directories by default
-Directories must be empty to be removed with
“rmdir” or must be removed with “rm-r”
11
Q
mkdir
A
- Make a directory
- Create a folder for file storage
-mkdir Directories
>mkdir notes
12
Q
chmod
1
A
- 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)
13
Q
chmod
2
A
- chmod 744 first.txt
- User ; read , write , execute
- Group ; read only
- Other ; read only
- chmod a-w first.all
- all users , no writing to first.txt
- chmod u+x script.sh
- The owner of script.sh can execute the file
14
Q
chown
A
- Change file owner & group
- Modify file settings
-sudo chown [OWNER : GROUP] file
15
Q
iwconfig / ifconfig
A
- iwconfig
- View or change wireless network configurations
- ESSID , frequency / channel , mode , rate , etc
- Requires knowledge of the wireless network
- iwconfig eth0 Essie studio-wireless
- ifconfig
- View or configure a network interface & IP configuration
- ifconfig eth0