Open main menu

CDOT Wiki β

Changes

Week 2 Notes

3,877 bytes removed, 21:43, 30 August 2017
Buzzwords
* To abort the current editing session, press <ESC> :q! <ENTER>
 
= Buzzwords =
CLI: command line interface
GUI: graphical user interface
 
File utilities discussed in class
 
----
 
pwd : print working directory tells you where you are in the filesystem
ls : list (files in current directory)
ls -l: long list files (show all file properties)
cd : change directory
find: find files
clear: clear the screen
rm : remove files (delete them - NO UNDO)
 
Symbols discussed in class
 
----
 
~ : home directory
/ : root directory (also path separator when not the first char)
 
Shortcuts discussed
 
----
 
ARROW UP/DN for moving forward or back through command history
CTRL+L: clears the screen
TAB: completes command (or directory/file name)
TAB TAB: shows all completions when not unique
 
 
 
LINUX/UNIX maxims discussed
 
----
 
 
* UNIX is an oral tradition
 
* UNIX is a humble servant but brutal master
 
* You got to know what you are looking for before you find it
 
* No news is good news.
 
* Everything is a file, yes even directories, disks, cdrom, usb, etc.
 
List of commands used so far
 
----
 
Begin by creating a '<tt>rough_work</tt>' directory, as shown below ($ indicates shell
prompt)
 
$ cd
$ mkdir uli101
$ cd uli101
$ pwd
/home/mark.fernandes/uli101
 
$ mkdir rough<sub>work</sub>
$ cd rough<sub>work</sub>
$ pwd
/home/mark.fernandes/uli101/rough<sub>work</sub>
 
Now you can continue as shown in the examples below
 
 
File management commands
 
----
 
All of file management stuff falls under the four sub headings:
 
# C: create
* to create a file use: touch, or a text editor like vi
* for example ($ indicates shell prompt)
$ touch file
 
# R: read (view/look)
* to look through a file you can use: less, cat
* for example ($ indicates shell prompt):
$ less file
$ cat file
(since there is nothing in the file you will not see anything)
 
 
# U: update (copy/move/rename)
* to copy a file use: cp
* for example ($ indicates shell prompt):
$ cp file file1
$ cp file1 file11
$ ls
file file1 file11
* to move a file use: mv
 
<code>~~</code>
$ mv file\* a
mv: target \`a' is not a directory
$ mkdir a
$ mv file\* a
$ tree
.
a
file
file1
file11
 
1 directory, 3 files
<code>~~</code>
 
* to rename a file use: mv
 
<code>~~</code>
$ cp a/\* .
$ ls
a file file1 file11
$ mv file1 file4
$ mv file11 file44
$ ls
a file file4 file44
<code>~~</code>
 
 
# D: delete
* to delete a file use: rm
 
Directory management commands
 
----
 
# C: create
* to create a directory use: mkdir
 
# R: read (view/look)
* to look through a directory you can use: ls, echo
 
# U: update (copy/move/rename)
* to copy a directory use: cp
* to move a directory use: mv
* to rename a directory use: mv
 
# D: delete
* to delete an empty directory use: rmdir
* to delete a non-empty directory use: rm -r
 
 
List of symbols used thus far
 
----
 
* all files (in shell globbing)
 
? any character (in shell globbing)
. current directory
.. parent directory
~ home directory
/ root directory, and path separator
 
This file is used for the week 2 practice quiz. The PDF file with all the questions are in:
 
/home/mark.fernandes/uli101/weekly<sub>notes</sub>/wk2practice.pdf
 
Complete all ten questions of the practice quiz to help you understand the main concepts of
week 2. You can ask your friends or the teacher for any of the answers to the quiz.
 
Remember Linux/UNIX is all about knowing the commands and using them correctly, so understand the
questions asked and the answers. It is always possible that there might be one or more ways of
answering some of the questions asked. Knowing all the ways to do something is not as important as
knowing at least one way correctly.
= File utilities discussed in this section =
221
edits