prompts / test.csv
westenfelder's picture
init
6b5ecd6
nl,bash
show the free space on all filesystems,df -h
lists the name and pids of the top 5 processes by percentage of CPU usage,"ps -eo pid,comm,%cpu --sort=-%cpu | head -n 6"
shows how much free memory a system has,free -h
shows how much free space there is on the root filesystem,df -h /
shows the disk space used by the directory /var/log,du -sh /var/log
show the last date and time the system was rebooted,who -b
show how long the system has been up,uptime -p
who is currently logged into the system,who
install wget on Redhat without user input,yum install -y wget
set my user's time zone to Los Angeles,timedatectl set-timezone America/Los_Angeles
show the version of the kernel,uname -r
show the version of the operating system,cat /etc/os-release
find the largest file under my home directory,find ~ -type f -exec ls -lh {} + | sort -k 5 -hr | head -n 1
make data.dat readable by just the owner,chmod 400 data.dat
set the file creation mask so that only the owner has file write permission,umask 037
create a new file called data.dat with a size of 512K bytes,truncate -s 512K data.dat
create an ext3 filesystem in my existing file named disk.img,mkfs.ext3 disk.img
set the system's timezone to Los Angeles,timedatectl set-timezone America/Los_Angeles
create a new group called alfa,groupadd alfa
add user test to the group called alfa,usermod -aG alfa test
add user test to the alfa group as administrator,usermod -aG alfa test; gpasswd -A test alfa
remove the group password from the alfa group,gpasswd -r alfa
restrict access of all users in the group named alfa,chmod -R o-rwx /path/to/directory
remove user test from the alfa group,gpasswd -d test alfa
remove the alfa group,groupdel alfa
add a new user named test,adduser test
add a login for a new user named test which expires 90 days from today,"useradd -e $(date -d ""+90 days"" +%Y-%m-%d) test"
give me the date 90 days from today,"date -d ""+90 days"""
create a new systems group called alfa2,groupadd alfa2
lock user test2's account,usermod -L test2
force user test2 to change their password at next login,chage -d 0 test2
modify the access time of my file data.dat to be 12:00 on 2022-12-31,touch -a -t 202212311200 data.dat
create a FIFO named myfifo in /tmp,mkfifo /tmp/myfifo
insert #!/usr/bin/python3 at the top of each *.py files under the current directory,"for file in *.py; do sed -i '1i #!/usr/bin/python3' ""$file""; done"
rename all of my files named test.py replacing the string test with unit_test,find . -type f -name 'test.py' -execdir mv {} unit_test.py \;
prefix every non-blank line in file.log with the string 'hello',sed '/./ s/^/hello/' file.log
change the file extension from .mpg to .avi every file in directory /home/test/uploads,"for file in /home/test/uploads/*.mpg; do mv ""$file"" ""${file%.mpg}.avi""; done"
prefix the line number to every line in file.log,nl -ba file.log
make the file pretty-print.sh executable,chmod +x pretty-print.sh
append all PNG and JPG files to the existing tar archive file images.tar,tar -rf images.tar *.png *.jpg
calculate the md5 checksum of every file under the directory named downloads,find downloads -type f -exec md5sum {} +
change the group ownership to alfa of my file named download.dat,chgrp alfa download.dat
count all of the directories under my home directory,find ~ -type d | wc -l
list the *.dat files in the current directory in ascending order by size,ls -lS --block-size=1 --reverse *.dat
create the path src/vpd/new without an error if the path already exists,mkdir -p src/vpd/new
list all files in my Downloads directory which have not been accessed within the last 3 weeks,find ~/Downloads -type f -atime +21
count the total number of lines in the *.c files under my src directory,"find src -name ""*.c"" -type f -exec wc -l {} + | awk '{total += $1} END {print total}'"
find all *.c and *.h files under the src directory containing the pattern TODO and print just the file names,"grep -lR ""TODO"" src --include \*.c --include \*.h"
show the fully-qualified domain name of my host,hostname -f
"calculate the number of days between the dates Jan 12, 2023 and Jan 20, 2024","echo $(( ($(date -d ""Jan 20, 2024"" +%s) - $(date -d ""Jan 12, 2023"" +%s)) / 86400 ))"