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;
45 Cards in this Set
- Front
- Back
Copy files
|
cp <filename> <new location>
|
|
Move files
|
mv <filename> <new location>
|
|
Rename files
|
mv <old filename> <new filename>
|
|
Delete files
|
rm <filename>
rm <filename> -f to delete without having to answer y/n if you're sure note: no recycle bin or undo for these deletions |
|
Create directories
|
mkdir <directory name>
|
|
Delete directories
|
rm -rf <directory name>
|
|
Change directory
|
cd
|
|
Edit text files
|
vi <filename>
or gedit <filename> This will open text files in Gedit. |
|
View text files
|
less <filename>
Use cursor keys up and down to move through document. Q to quit. |
|
Print text files
|
lpr <filename>
|
|
Compare files
|
diff <file1> <file2>
|
|
Find files
|
find -name <filename>
|
|
Check disk integrity
|
fsck
This is a system command and can be run only on a disk that isn’t currently in use. To scan the main parti- tion, you’ll need to boot from the installation CD and select the rescue option. Then issue the fsck command. |
|
View network settings
|
ifconfig
|
|
Check a network connection
|
ping <address>
|
|
View a network route
|
tracepath <address>
|
|
Clear screen
|
clear
|
|
Get help
|
man <command>
or info <command> |
|
Quit
|
exit
|
|
List files in current directory
|
ls
|
|
ls options ("flags" or "switches")
|
ls -m fit as many possible on one line
ls --help shows all options ls -l "long" permissions, owners, etc. ls -a shows hidden files ls -lh h = human readable (kilobytes and megabytes instead of bytes) |
|
Copy a directory and its contents (and all directories and files w/in that directory)
|
cp -r
-r stands for "recursive" |
|
Reference current directory
Reference parent directory |
.
.. For example cd .. will go up a directory. . or ./ references current dictory. |
|
Working with spaces
|
mv "picture from germany.jpg" mydirectory/
or mv picture\ from\ germany.jpg mydirectory/ |
|
Create a directory and a new directory to contain it Fwd:
|
Use the -p command option. E.g.
mkdir -p flowers/daffodil |
|
File permissions
ls -l |
r = read
w = write x = execute (or for directories, access) - --- --- --- type of file; owner; group; everyone else e.g. #1 -rw--r--r-- - = standard file rw- = owner can read/write r-- = group can read only r-- = everyone else can read only e.g. #2 drwxr-xr-x d = directory rwx = read/write/access; with directories x means you can access the directory) r-x = group can read/access r-- = everyone else can read/access File Type Codes: Standard file - Standard directory d Symbolic link (a shortcut to another file) l Named pipe (a file that acts as a conduit for data between two programs) p Socket (a file designed to send and receive data over a network) s Character device (a hardware device driver, usually found in /dev) c Block device (a hardware device driver, usually found in /dev) b |
|
Change file permissions: Everyone can read and write to it
|
chmod a+rw <file>
add read write permissions (rw) to all users (a) |
|
Change file permissions: Take away ability of all users to write
|
chmod a-w <file>
take away write (w) permissions from all (a) users, but leave everything else as is |
|
Change file permissions: Add read/write permissions for...
- owner - group - non-owner non-group memebers - all |
- chmod u+rw <file>
- chmod g+rw <file> - chmod o+rw <file> - chmod a+rw <file> OR chmod +rw u = user/owner g = group o = others a = all (default) |
|
Change file permissions: Make a program downloaded from the internet executable
|
chmod u+x <program>
|
|
Change file ownership (e.g. to frank)
|
sudo chown frank myfile
|
|
vimtutor
|
learn vim
|
|
whereis
|
e.g. whereis mysql
... will show you where mysql lives in the directories. |
|
log in to MySQL
|
mysql -h host -u user -p
(wait for the password prompt) note: W/ localhost, you can omit -h |
|
(mysql) create a databse
|
CREATE DATABASE dbname;
|
|
(mysql) switch default database for session
|
USE dbname
(no semicolon is used with the USE statement because it's a client-based SQL statement) |
|
(mysql) create table
|
CREATE TABLE tblname (
field TYPE, field TYPE); |
|
(mysql) view structure of a table
|
DESCRIBE table;
|
|
make changes to a table (mysql)
|
ALTER TABLE tablename
CHANGE COLUMN name newname details, ADD COLUMN name details; |
|
get a list of databases (mysql)
|
SHOW DATABASES;
|
|
get a list of tables in a database (mysql)
|
SHOW TABLES;
(to change databases do USE dbname then SHOW TABLES;) (to see tables in another db without changing databases do this SHOW TABLES FROM dbname;) |
|
add rows of data to a table
|
INSERT INTO tablename
(name, title, describtion) VALUES ('Tom', 'Executive Director', 'the boss'); note: if you're going to enter values for all the columns in the table, you don't need to name the columns, but you must list the data in the same order in which the columns are listed in the table. |
|
basic SELECT statements
|
SELECT * FROM books;
or SELECT book_id, title, description FROM books WHERE genre = 'novel'; |
|
inner join
and concatenate |
SELECT book_id, title, pub_year,
CONCAT(author_first, ' ', author_last) AS author FROM books JOIN authors USING(author_id) WHERE author_last = 'Greene'; if joined fields have different names use a different clause/method: JOIN authors ON (author_id = writer_id) |
|
get ID of last inserted record
|
SELECT LAST_INSERT_ID();
|