Command Deck Flashcards
Review command function
ll
list directories/files with permissions details
Similar to ls-l
rm
removes a file/deletes a file
rm -r
removes/deletes a directory or file
Go back to the root directory (“/root” NOT “/”)
cd ~
Make a copy of dir4 to be copied into dir5
cp -r dir4 dir5
Change the name of file good_burger to bad_burger
mv good_burger bad_burger
Move file3 into dir1
mv file3 dir1/
The files and folders have to be in the same directory level to move files into folders
Display the contents of file5 with numbered lines
cat -n file5
Find file study.log in the system
find / -name study.log
Login to the following server remotely using vsc:
Server Name: 198.58.119.40
Username: u5bt
Password: abc
Command:
ssh u5bt@198.58.119.40
Prompt:
user u5bt
enter password: enter abc
Login to a LightSail Centos 7 server remotely with the public ip_address 184.24.68.30 using key access. The key is deVops
- cd into Downloads folder to access the key
- type: ssh -i deVops.pem centos@184.24.68.30
Display the following message in the command line:
Thank you God for this opportunity. I pray for future success.
echo Thank you God for this opportunity. I pray for future success.
whoami
Gives your user id
id -r user2
Print real user ID for user2
id -G user3
Print effective group ID for user3
iostat
Check cpu, os, kernel name and version, hard drive info, server size, cpu percentage, date, ip address
Run an inventory on the server
- Check # hard drives - iostat or lsblk
- Check # of cpus (and data) - iostat or nproc (lscpu)
- Check cpu percentage - iostat
- Check kernel type and name - uname + uname -r
- Check OS type - cat /etc/*release
- Check memory - top or free
lscpu
access system inventory
* brand, model, model name, speed and so on
List commands required to obtain cpu information
- lscpu
- nproc
- iostat
- top
List commands required to obtain hard drive information
- lsblk
- iostat
Obtain OS name, version and associated information on a Ubuntu server
lsb_release -a
Obtain OS name, version and associate information on a Centos server
- cat /etc/os-release
OR - cat /etc/*release
Obtain kernel name
uname or uname -s
Command for kernel release (version)
uname -r
control L
clears the screen; alternative to clear command
Delete directory Dir8
rm -r Dir8
Print output for lscpu into an existing file called fil5 without erasing the existing data within the file
lscpu > > fil5
While editing in vi (insert mode), add numbers to each line
- Press ESC
- :set nu
Obtain the word count for file10
wc -l file10
Print the first 10 lines for file6
head -10 file6
Building a webpage with the message:
This is my first website, and I’m loving it!
- systemctl start httpd
- systemctl enable httpd
- cd /var/www/html/
- touch index.html
- vi index.html
- <h1> This is my first website, and I’m loving it! <h1>
</h1></h1>
Without switching to the root user, install apache on your server w/o having to confirm the installation
sudo yum install httpd -y
As the root user, remove the korn shell on your server
yum remove ksh
Find the inode # of file15
ls -i file15
ls -li Dir4
Displays inode #, link #, permissions, user, group info and date for files in Dir4
Display the following message on the command line:
“We are learning and becoming better!”
echo We are learning and becoming better!
history
display a list of previously executed commands in the current shell session
Within the bash shell
echo $? is to …
display the exit code for the previous command, establishing if the command was successful = 0 or not >0
uptime
displays the length of time the system has been running