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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

grep

A
  • Find a text in a file
    • Search through many files at a time

-grep PATTERN [file]
>grep failed auth.log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

cd

A
  • Change current directory
    • Nearly identical to Windows Command Line
    • Forward slashes instead of backwards

-cd
>cd/var/log

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
    passwd [username]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

mv

A
  • Move a file
    • Rename a file

-mv SOURCE DEST
>mv first.txt second.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

cp

A
  • Copy a file
    • Duplicate files or directories

-cp SOURCE DEST
>cp first.txt. second.txt

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

mkdir

A
  • Make a directory
    • Create a folder for file storage

-mkdir Directories
>mkdir notes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

chown

A
  • Change file owner & group
    • Modify file settings

-sudo chown [OWNER : GROUP] file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

ps

A
  • View the current process
    • And the process ID (PID)
    • Similar to Windows Task Manager
  • View user processor
    • ps
  • View all process
    • ps-e | more
17
Q

apt-get

A
  • Application Packaging Tool
    • Handles the management of application packages
    • Applications & Utilities

-Install , update , remove
>sudo apt-get install wireshark

18
Q

vi

A
  • Visual mode editor
    • Full screen editing with copy , paste , & more

-vi File
>vi script.sh

  • Insert text
    • I
    • Exit insert mode with Esc

-Save (write) the file & quit = :wq

19
Q

dd

A
  • Convert & copy files
    • Backup & restore an entire partition

-dd if = of = [Options]

  • Creating a disk image
    • > dd if = / dev / sea of = / tmp / sea-image.img

-Restoring from an image
>dd if = / tmp / sda -image.img of = / dev / sda