NDOS515_Session_2 Flashcards
How to Organize your tree…?
- Some conventions:
- Desktop shows up on your GUI desktop
- Documents for …. documents.
- bin holds “binaries” and executable scripts
- public_html (sometimes) has your Web page(s)
- Otherwise, pretty wide open
- Two suggestions:
- Think about it early on
- Be willing to reorganize from time to time.
- Two suggestions:
Navigating on Command line
- pwd tells where you are
- cd to get to a new directory (folder)
- ~ refers to your home
- cd ~
- cd ~/music
- Leading slash (or ~) means “start at top”
- Absence of slash means “from here”
- cd ~/music/elvis
- cd ~/music; cd elvis
Linux Standard Directories
/bin Important executables /etc System configuration /home User homes /tmp Temporary files /usr/bin More executables
(There are more than just these…)
Redirection…?
The output of any command can be captured into a file:
ls > listing.txt
(Note: “.txt” isn’t necessary and is omitted by experienced Unix users)
You can add to a file, too:
ls /bin»_space; listing.txt
Viewing files…?
Short files can be viewed with cat: cat listing.txt For longer ones, use less: less bigfile (type space to see more, q to quit, h for help) Use file to find out what something is: file /etc/passwd
Copy, rename/move, delete…?
cp coolstuff coolstuff.bak
mv coolstuff.bak backup
mv backup my-backups/coolstuff.bak
rm my-backups/coolstuff.bak
A Philosophical Note…?
Unix (and Linux) is designed on the assumption that you don’t like chatty computers
Success is generally indicated by silence:
rm backup
rm backup2
rm: cannot remove `backup2’: No such file or directory
Directory Management…?
For historical reasons, directories are handled differently:
mkdir backups
rmdir obsolete
cp –r public_html backups/web-backup
rm –r backups
WARNING!!! rm –r is extremely dangerous. Never type Enter until you’ve triple-checked what you typed!
Globbing…?
It’s a pain to type lots of file names, so you can abbreviate: ls a* less *.txt (omits files starting with dot…why?) ls .??*
More choices, but these are common ones
Editors..?
What’s an editor?
- Shows you exactly what’s in the file
- Give you control over file contents
- Can be hard to learn
What’s a word processor?
- Usually easy for beginners to get started
- Puts priority on formatting and layout
- Shows you what printed page will look like
- File contents are very different from what you see
Simple Editors on Linux
Nano - Command-line - Fairly easy to start with - Word-wraps by default, which can be problematic gedit - GUI - Easy to get going
Powerful Linux Editors
vi
- Command line
- Hard to learn
- Modal
- Popular with many (because they learned it first?)
emacs
- Command line or GUI
- Hard to learn
- Amazingly powerful and flexible (too much?)
- Lets you click, type, use arrow keys and mouse (non-modal)
Religious Wars
Linux users get heated about editors
Criticize non-favorites, support their own
Don’t make decisions based on logic
Best way to choose an editor:
1. Decide how much work you’re willing to put out
2.Try at least two
- Give enough time to actually learn them well
- Choose significantly different ones
3. Pick based on what fits your preferences & needs
- DON’T choose one just because your friend uses it
The second lab
Review of
The ls, cat commands; file system layout and navigation.
Globbing
File redirection.