Section 1.11 -- Linux Commands Flashcards
(27 cards)
What is the help command in Linux?
Man for manual. eg. man grep
How to list directory contents in Linux?
LS – list directory. Lists files, directories, symbolic links. Color-codes files.
How to get a more detailed directory view in Linux?
ls -l OR type ls -l | more to present output one page at a time
What does a detailed directory view (in Linux) show?
Permissions, file owner, group that owns the file, file size, and date of last update.
How to display the current working directory path in Linux?
pwd – print working directory. useful when changing directories often.
how to change the name of a directory in Linux?
mv – move a file. syntax is mv SOURCE DESTINATION
how to copy a file in Linux?
cp SOURCE DEST. new file will be named whatever “dest” is
how to remove files or directories in Linux?
rm deletes files and (empty) directories
What are the permissions associated with a file in Linux?
r = read
w = write
x = execute
How are permissions listed in the Linux terminal?
user, group, others,
e.g. rwxr–r–, indicating that users can read write and execute, but groups and others can only read
What is the octal notation for permissions in Linux?
7 = rwx
6 = rw-
5 = r-x
4 = r–
3 = -wx
2 = -w-
1 = –x
0 = —
What is the command and syntax to change permissions in Linux?
chmod mode FILE
e.g. chmod 744 script.sh
where 744 indicates that users can rwx, but users and others are only r–
What is the command and syntax to change permissions in Linux (non-octal)?
chmod mode FILE
e.g. chmod a-w first.txt means that we’re removing write permissions from first.txt
e.g. chmod u+x script.sh means we’re adding execute permissions to the owner of script.sh
how to change the name of the owner and group using the linux terminal?
chown
syntax: sudo chown [owner:group] file
e.g. sudo chown messer third.txt changes the file owner to messer
How do you run a command as an admin in Linux?
su / sudo – runs the command as a superuser or as a different user ID. type su to become a superuser at the beginning of a session and exit to not be a superuser anymore
How to install an application in the Linux terminal?
apt-get – stands for advanced packaging tool. lets you install, update, and remove
syntax: sudo apt-get install wireshark
How do you install an application in a Redhat-based linux system?
Not apt-get! Instead use yum (Yellowdog Updater, Modified) to install, delete, and update
How do you manage network interfaces using linux?
the ip command allows you to look at config:
ip address
routing tables
ip rout
and configure
sudo ip address add [ip address/subnet mask dev adapter]
How do you know how much free space is available on a Linux system?
df – view file systems and free space. this defaults to showing you the space available in 1k blocks.
use df -h to see human-readable units
How do you search files using the Linux terminal?
grep – find text in any file on the system
syntax: grep PATTERN file.txt
How do you see running processes on a linux system?
ps – view current process and process ID, similar to task manager
ps -e – see all running processes on a system
How does the “more” command work in a Linux system?
you pipe the command by adding “| more” after a prompt like ps, e.g. “ps -e | more”
Press space to advance the page, enter to go line by line, and q to quit
How do you find resource utilization in linux?
top – gives an overview of all running processes, CPU, RAM, and resource allocation
Hit enter to refresh, hit q to quit
How do you find a file name or extension in linux?
find
syntax: find . -name “*.txt”
here, “.” indicates to start with your current directory, and “*.txt” means “any doc with a .txt extension”