dir
- list (dir)ectories.cd
- (c)hange (d)irectory - Changes to a different folder or directory.
mkdir
- (m)a(k)e (dir)ectory - Creates a new folder or directory.
rm
- (r)e(m)oves a file.
mv
- (m)o(v)e a file or can be used to rename a file.
cp
- (c)o(p)y a file to another location.
grep
- prints lines that match the pattern.
touch
- creates a file.
cat
- prints out the contents of a file.
echo
- prints the string.
>>
- appending output without removing previous text in a file.
>
- rewriting the output to a file.
|
- pipes the output.
shutdown
- causes the computer to shutdown.
reboot
- causes the computer to reboot.
man
- searches for the documentation of a certain command.
whatis
- provides a one line description of the command.
whoami
- returns the user.
find
- searches for a file.
Usage of Commands:
Changing/Making/Removing a File
touch text.txt
- creates a file called 'text.txt'.
echo "some text" >> text.txt
- writes 'some text' into a file called 'text.txt'.
echo "some other text" > text.txt
- rewrites 'some other text' into a file called 'text.txt'.
echo "" > text.txt
- easy trick to truncate a file without removing it.
Changing/Making/Removing Directories
mkdir somedirectory
- creates a directory called 'somedirectory'.
rmdir somedirectory
- removes a directory called 'somedirectory'.
rmdir -r somedirectory
- removes a directory and all of the contents in 'somedirectory'.
cd ~
- changes to the home directory.
cd /
- changes to the root directory.
cd ..
- moves down a directory.
Miscellaneous
man man
- provides information on the man command itself.
ls | grep "word"
- this will highlight any directory that contains the pattern "word".
find -name "*.pdf"
- searches for all pdf files.
cat text.txt
- quick way to display the contents of a text file in this case will display the contents of text.txt.
pwd
- displays the current directory that you are in.
cp file.txt /home/file.txt
- copies the file to the home directory saved as file.txt.
cp /home/* /etc
- copies all the home files to /etc directory.