date -- cal
df -- to see the current amount of free space on your disk driver
free -- to display the amount of free momery
2 - Navigation
pwdcd -- relative path
cd ~[user_name] -- home directory
3 - Exploring The System
ls ~ /usr -- multiple directories
ls -l -- long formatls -lt -- sort by the file's modification time
Option
Description
-F
Append a “/” if the name is a directory.
-S
Sort results by file size.
-t
Sort by modification time.
-r
Reverse.
drwxr-x--- 4 sty staff 1366310:11 .android
1-3-3-3 -- access rights to the file
1 -- indicates the type of file, "/" means a regular file, "d" indicates a directory
3 -- access rights for the file's owner3 -- for the file's group3 -- for everyone else
file filename -- determining a file's type
macbook:EBooks sty$ file TLCL-16.07.pdf
TLCL-16.07.pdf: PDF document, version1.4
less -- view file contents
less is more
Directory
Comments
/
The root directory. Where everything begins.
/bin
Contains binaries programs that must be present for the system to boot and run.
/boot
Contains the Linux kernel, initial RAM disk image, and the boot loader.
/dev
“Everything is a file”.
/etc
Contains all of the system-wide configuration files.
/opt
Used to install “optional” software. Mainly used to hold commercial software products.
/usr
Contains all the programs and support files used by regular users.
/usr/bin
Contains the executable programs installed by your linux distribution.
/usr/lib
The shared libraries for the programs in /usr/bin.
/usr/local
Where programs that are not included with your distribution but are intended for system-wide use are installed.
/usr/sbin
Contains more system administration programs.
/usr/share
Contains all the shared data by programs in /usr/bin. Includes things like default configuration files, icons, screen backgrounds, sound files, etc.
4 - Manipulating Files And Directories
cp
mv
mkdir
rm
ln-- create hard and symbolic links
wildcards
Wildcards
Matches
Data???
Any file beginning with Data followed by exactly three characters
[abc]*
Any file beginning with either an “a”, “b”, or “c”
Backup.[0-9]
Any file beginning with Backup followed by one number
[[:upper:]]*
Beginning with an uppercase letter
[![:digit:]]*
Not beginning with a numera
*[[:lower:]123]
Ending with a lowercase letter or the numerals 1, 2, or 3
mkdir
mkdir dir1 dir2 dir3
cp
cp item... directory. -- to copy multiple items
Command
Results
cp file1 file2
If file2 exists, it is overwritten with the contents of file1, if not, create file2.
cp -i file1 file2
Same as above, except that if file2 exists, the user is prompted before it is overwritten.
cp file1 file2 dir1
Copy file1 and fie2 into directory dir1.
cp dir1/* dir2
Using a wildcard, all the files in dir1 are copied into dir2.
cp -r dir1 dir2
After the copy, dir2 will contain the same contents as directory dir1.
mv
mv item1 item2 -- to move or rename file or directory item1 to item2
mv item... directory -- move one or more items from one directory to another
rm
Command
Results
rm file1
Delete file1 silently.
rm -i file1
Prompt while deleting.
rm -r file1 dir1
Delete file1 and dir1 and its contents.
rm -rf file1 file2
^_^
ln — create links
ln file link-- hard link
ln -s item link-- symbolic linkwhere item is either a file or a directory