| | |
|---|
| curl -o myfile.txt http://www.some_url.com | curl | grab a url |
| mysql -u name -p | mysql | connect |
| select t2.name from tabletwo as t2, tableone as t1 where t1.id = t2.id; | mysql | simple join |
| alter table applications add column nickname varchar(255) after monkeys; | mysql | add column to table |
| update pets set doggie_name = 'rex' where doggie_name = 'oscar'; | mysql | update field value |
| select t1.name as person, t2.name as doggie, t3.name as kitty from people as t1 left outer join dogs as t2 on t1.dog_id = t2.id left outer join cats as t3 on t1.cat_id = t3.id where t3.name = 'lumpah'; | mysql | left outer join |
| alter table pets change dogs cats varchar(255); | mysql | rename existing column in table |
| mysqldump --opt -u username -p databasename > backupfilename.sql | mysql | dump database |
| mysql -u username -p databasename < backupfilename.sql | mysql | import database |
| show grants for username@host; | mysql | show grants |
| show databases; | mysql | show databases |
| show tables; | mysql | show tables |
| desc table_name; | mysql | describe table |
| select count(distinct something) from tablename; | mysql | count stuff |
| chown user myfile.txt | bash unix | change ownership |
| tar -zxvf myfile.tar.gz | bash unix | untar |
| tar -cvzf myarchive.tgz directory_to_tar | bash unix | tar a directory |
| scp -r servername:/remotedir /localdir/localsubdir | bash unix | scp across servers |
| chmod 755 myfile.txt | bash unix | change permissions - number method |
| chmod u+w,go-w myfile.txt | bash unix | change permissions - manual method |
| tail -40 logname.log | bash unix | tail a file with -40 lines showing |
| grep -r -i term_to_find path_to_directory | bash unix | grep to find stuff |
| df -h | bash unix | disc space on linux box |
| du -sh /path/to/directory | bash unix | disc space of directory |
| shutdown -r now | bash unix | restart |
| shutdown -h now I'm gonna shutdown right now! | bash unix | shutdown |
| telnet ip_address_to_test port_to_test | unix bash windows | test both address and port |
| $ find . -name '*.xml' -exec grep 'mystring' {} \; | bash unix | find xml files containing mystring |
| ln -s target link_name | bash unix | symlink |
| cp -R mydir /path/to/PARENTdir | bash unix | overwrite common files in directory when copying |
| C:\Windows\system32\drivers\etc | windows | location of hosts file |