Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
27 Cards in this Set
- Front
- Back
create a hierarchy of directories (e.g. /tmp/all/my/folders) in one command
|
mkdir -p /tmp/all/my/folders
|
|
list a directory in a long format
|
ls -l
|
|
remove a directory
|
rmdir <directory>
|
|
remove a non-empty directory
|
rm -r <dir>
-r for "recursively" |
|
show first 5 lines of a file ("head")
|
head 5 <file>
|
|
show last 5 lines of a file ("tail")
|
tail 5 <file>
|
|
stream the entire file on the screen
|
less <file>
Opens Less text editor |
|
given a text file, print only the lines containing the letter 'a'
|
grep "a" <file>
|
|
list the current directory, showing only the files that have a particular extension (e.g. txt)
|
ls *.txt
|
|
count the number of lines in a text file
|
wc -l <file>
|
|
count the number of words in a text file
|
wc -w <file>
|
|
use redirection to list files, then select only the ones with a specific extension, then count their number
|
ls | grep "*.txt"
|
|
use redirection to list files, then select only the ones with a specific extension, then count their number
|
ls | grep ".txt" | wc -l
|
|
find all files in your home directory that start with letter "b"
|
find ~ -name *.txt -print
|
|
show the manual entry page for a given command
|
man <command>
man for Manual |
|
show the list of environment variables
|
env
|
|
create a new environment variable
|
export SEASON=winter
the variable has to be in capitals and there should be no spaces before or after the = sign |
|
check that a given environment variable exists
|
echo $ENVVAR
Always use $ and all variables are in capitals |
|
modify your ~/.bash_profile file to permanently set an env variable and check that it works in a new terminal
|
echo "export COUNTRY=uk" >> ~/.bash_profile
|
|
show the permissions for a file
|
ls -l | grep <file>
|
|
remove the execute permission for the user and for the group
|
chmod ug-x <file>
|
|
add the write permission for the "other"
|
chmod o+w <file>
|
|
create a directory and remove the permission that allows you to change into it
|
mkdir <dir>
|
|
use the 'echo' command to print "hello, world!" on the screen
|
echo hello, world
" " are also fine |
|
create a file hello.rb and add the line "puts 'hello, world!'" into it using command line only. Run it by passing its name as an argument to ruby.
|
touch hello.rb
echo puts 'hello, world! << hello.rb ruby hello.rb |
|
create a file hello.rb and make sure you can execute it by running it directly (hint: you'll need a ruby shebang + specific permissions.
|
touch hello.rb
add !#/usr/bin/env ruby to the top of hello.rb chmod u+rwx hello.rb |
|
list all processes on the system ("ps" command with some extra flags), find out how many processes of Google Chrome are running using grep and wc
|
ps | grep "Google Chrome" | wc -l
|