1/66
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
how to see current directory?
pwd. output looks like: /home/accts/ehs72/tutorial
how to change directory?
cd dirname. no output
how to make directory?
mkdir newdirname
how to rename file or directory?
mv oldname newname
how to move files into different directories?
mv filename dirname
how to print current date or time?
date. ex: Mon Mar 31 01:54:18 PM EDT 2025
how to create new file?
touch newfilename
how to update modification date and time of a file?
touch oldfilename. results from this can be seen with ls -l
how to copy a file?
cp filename copyfilename
how to copy a directory?
cp -r dirname copydir
how to remove file?
rm file
how to remove directory?
rmdir dirnam
how to print out file?
cat file
how to print first lines of file
head
how to print last lines of file
tail
removes any directory even if not empty
rmdir -r
asks for permission before removing
rm -i / rmdir -i
prints out first five lines of filename
head -n 5 filename
how to just print something
echo ––whatever––
how to change contense of file?
echo ~your words~ > oldfilename
how to make a new file with words you want in it
echo ~your words~ > newfilename
how to add lines to a file contianing the words you want?
echo ~your words~ » oldfilename
returns the number of lines words and characters in filename
wc filename. ex: 1 2 10 newcrazyfile
what is like wc but without the filename?
wc < filename ex: 1 2 10
what stands for any character
?
what stands for any length string?
*
how to display the differences between two files?
diff file1 file2 ex: 1,2c1
< apple orange banana
< kiwi mango
---
> hello world
(< means its in file1, > means it’s in file2)
how to return a line from a file containing a certain string?
grep string filename
how to use grep to find all html files?
ls | grep html
how to use grep to find all instances of ‘hello world‘ in file1 and file2
cat file1 file2 | grep “hello world”
how to determine type of file?
file filename ex: comp1: directory
how to print out username?
whoami ex: esimmons ex: ehs72
what is this the output of: uid=25324708(ehs72) gid=25324708(ehs72) groups=25324708(ehs72),20166(202501_cpsc.201.01-student)
id
what is this the output of: 15:21:06 up 14 days, 5:55, 2 users, load average: 0.21, 0.22, 0.20
uptime
what is this the output of:
qam6 pts/12 2025-03-31 15:09 (172.27.75.217)
ehs72 pts/16 2025-03-31 15:19 (172.27.203.240)
who
what is this the output of: 15:24:16 up 14 days, 5:58, 2 users, load average:
0.35, 0.28, 0.22
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
qam6 pts/12 172.27.75.217 15:09 11:47 0.02s 0.01s python3 /c/cs20
ehs72 pts/16 172.27.203.240 15:19 0.00s 0.01s 0.00s w
w
what is this the output of: esimmons
ttys000 Mon Mar 31 15:33 still logged in
esimmons ttys000 Mon Mar 31 15:17 - 15:17 (00:00)
esimmons ttys000 Mon Mar 31 15:16 - 15:16 (00:00)
esimmons ttys000 Mon Mar 31 14:30 - 14:30 (00:00)
esimmons ttys000 Mon Mar 31 13:48 - 13:48 (00:00)
esimmons ttys000 Mon Mar 31 13:43 - 13:43 (00:00)
esimmons ttys000 Mon Mar 31 13:38 - 13:38 (00:00)
esimmons ttys000 Mon Mar 31 13:38 - 13:38 (00:00)
esimmons ttys000 Sun Mar 30 13:16 - 13:16 (00:00)
esimmons ttys000 Tue Mar 25 16:52 - 16:52 (00:00)
last
what is this the output of: Darwin
uname
what is this the output of:
4 ./.ssh
204 ./.config/pulse
du (disk storage)
what is this the output of:
total used free shared buff/cache available
Mem: 131456752 4799364 59037008 56476 67620380 125348616
Swap: 2097148 0 2097148
free
what is this the output of:
Login: sbs5 Name: Slade Stephen
Directory: /home/accts/sbs5 Shell: /bin/bash
Last login Mon Mar 31 10:24 (EDT) on pts/0 from 10.66.205.218
No mail.
No Plan.
finger sbs5
how are read write execute permissions stored?
3 bits for you, group, and world. in order read write execute. represented in binary.
how to change permissions on a file or directory?
chmod 777 (or other number) file-or-dir-name
how to change owner or group?
chown/chgrp new-owner file
how to define a variable? How do define a variable equal to a unix command? An expression?
VAR=’var definition’; VAR=$(pwd) BACKTICKS
how to print the value of a variable?
echo $VAR
how do you display the value of variables?
set
how to remove a variable definition?
unset VAR
how to find the type of a command?
type command
what is this the output of: cat is /usr/bin/cat; cd is a shell builtin
type cat; type cd
what is this the output of: /usr/bin/cat
which cat
how to zip and unzip?
gzip, gunzip
how to print out last 10 commands?
history 10
what does !-2 do? what does !cat do?
exicute second to last command, exicute last cat command
how to execute code in a file?
source filename
what is this the output of?
alias less='less -R'
alias lisp='/usr/bin/sbcl'
alias ll='ls -alF'
alias
how to define a new command
alias comand_to_type=command
what is this the output of:
PID TTY TIME CMD
2965211 pts/6 00:00:00 bash
2967742 pts/6 00:00:00 python3
2967825 pts/6 00:00:00 sh
2967826 pts/6 00:00:00 ps
ps
what is this the result of?
[1]+ Running sleep 100 &
>sleep 100 &
>jobs
what is this the output of?
[1]- Running sleep 100 &
[2]+ Terminated sleep 50
>sleep 100 &
>sleep 50 &
>kill %2
>jobs
how to resume paused jobs in the background
bg %#
how to move a job from the background to the foreground
fg #%
what does a A “+” refer to? a “-” ?
current job, past job.
Suspend process in the foreground and move it to the background.
^Z
what is this the output of:
[1]+ Stopped python3 query_optimal_fast.py
^Z
what is this the output of:
[1] 11563
sleep 100 &
what is the input for:
ls is aliased to `ls --color=auto'
>alias ls=