Linux Administration

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Write a basic script to gather information. (1 or 2 items)

#!/bin/bash # Get the current date and time current_date_time=$(date +"%Y-%m-%d %H:%M:%S") echo "Current Date and Time: $current_date_time" echo "------------------------" # Get the list of logged-in users echo "Logged-in Users:" who | awk '{print $1}'

How do I retrieve a list of users?

cat /etc/passwd

How do I change permissions of a file?

chmod u+rw example.txt - for remove, type chmod for more info

How do you copy a file?

cp -a gaming.txt dir1/

how do I find the groups applied to a user?

groups username

How do you view the list of hard drives in linux?

lsblk

how do you make a directory?

mkdir /dir1/

How do I rename a file?

mv old_filename new_filename

how do I add a user?

sudo adduser username

How do I install a software package?

sudo dnf install vlc

how do you edit a hard drive?

sudo fdisk /dev/sdb then partition properly sudo mkfs.ntfs /dev/sdb1 sudo mkdir /mnt/new_drive sudo fdisk -l /dev/sdb sudo mount /dev/sdb1 /mnt/new_drive

How do I view a password of a user?

sudo grep username /etc/shadow

How do I create a group?

sudo groupadd groupname

Create LVM for VG

sudo pvcreate /dev/sdX1 sudo vgcreate my_vg /dev/sdX1 sudo vgdisplay my_vg sudo lvcreate -n my_lv -L 10G my_vg sudo mkfs.ext4 /dev/my_vg/my_lv sudo mkdir /mnt/my_mountpoint sudo mount /dev/my_vg/my_lv /mnt/my_mountpoint

List processes - change nice value

sudo renice -n <nice_value> -p <pid>

How do I set a command in advance with at?

sudo systemctl start atd echo "your_command" | at HH:MM

how do I add an existing group to an existing user?

sudo usermod -aG groupname username

How do you make a txt file?

touch gaming.txt

How do you unzip a file?

unzip example.zip And for directories unzip compressed_file.zip -d target_directory

How do you zip a file?

zip example.zip example.txt and for directories zip -r directory.zip directory_to_compress


Ensembles d'études connexes

international business chp 15 module

View Set

Pariwisata - Toursim Vocabulary List 1

View Set

EMT Chapter 37 Hazmat Study Guide

View Set

Unit 14: Social Psychology Study Guide

View Set

CPE Use of English: Word Transformations

View Set

Desert Processes and Landforms MMG + Clicker

View Set