Cheatography
https://cheatography.com
Basic commands
pwd |
Where am I in the system |
ls [path] |
List of given path. Common params -l -h -a |
cd [path] |
Change directory |
~ (tilde) |
Used in paths as a reference to your home directory (eg. ~/Documents ) |
. (dot) |
Used in paths as a reference to your current directory (eg. ./bin ). |
.. (dot dot) |
Used in paths as a reference to your current directories parent directory (eg. ../bin ). |
[KEY] TAB |
Start typing and press TAB. The system will auto complete the path. Press TAB twice and it will show you your alternatives. |
File manipulation
mkdir <dir name> |
create directory |
rmdir <dir name> |
remove empty directory |
rm <path> |
remove file also non-empty folder with -f param (-r recursively) |
touch <file name> |
create empty file |
cp <source> <destination> |
copy source to destination |
mv <source> <destination> |
move source to destination also used for rename |
Files (+filters)
head |
show the first n lines (-n) |
tail |
show the last n lines (-n) |
sort |
sort lines in a given way |
wc |
How many words, characters and lines. |
grep |
search for given patters |
Wildcards - May be used anywhere in any path
* |
Zero or more characters (eg. b*). |
? |
Single character (eg. file.???). |
[] |
Range (eg. b[aio]t). |
Useful commands
du -sh [dir/file] |
Disk usage (-s summary -h humman readable) |
df -h |
Display how much disk space is used and also free |
find /home -mtime -1 |
Find all files in the given directory (and subdirectories) which have been modified in the last 24 hours. |
shutdown -h now |
Shutdown the system. (Replace -h with -r for reboot.) |
reboot |
Restart machine |
date |
Show the current date and time |
whoami |
who you are logged in as |
finger <user> |
display information about user |
man <command> |
show the manual for command |
whereis <app> |
show possible location of app |
which <app> |
show which app will be run by default |
|
|
Persmissions
r |
read |
w |
write |
x |
execute |
permission order |
Owner(user) Group Other |
chmod <permissions> <path> |
hange permissions. Permissions can be either shorthand (eg. 754) or longhand (eg. g+x) |
Piping and Redirection
> |
Redirect STDOUT to a file. |
>> |
Redirect STDOUT to a end of file. |
2> |
Redirect the STDERR to a file. |
< |
Pass the contents of a file to a program as STDIN. |
| |
Feed the STDOUT of the program on the left as STDIN to the program on the right. |
Apache
Config files virtual hosts |
/etc/httpd/conf/httpd.conf |
hosting.znojmo.cz |
/etc/httpd/conf.d/virtualy.conf |
Restart service gracefull |
apachectl graceful |
Restart service hard |
sudo service apache2 restart |
Log file |
/var/log/httpd |
ispconfig specific |
/var/www/web1/log/ |
New virtual |
web-uzivatel |
MySQL
Config files |
/etc/mysql/ |
|
/etc/mysql/conf.d/ |
Restart service |
service mysql restart |
|
service mysqld restart |
|
/etc/init.d/mysqld restart |
Status service |
systemctl status mysql.service |
Log file |
/var/log/mysql/error.log |
Process management
CTRL + C |
Cancel the currently running process |
kill <process id> |
Cancel the given process. Include the option -9 to kill a stubborn process |
ps |
Obtain a listing of processes and their id's. Including the option aux will show all processes. |
jobs |
See a list of current processes in the background. |
CTRL+ Z |
CTRL + Z Pause the currently running process and put it in the background. |
fg <job number> |
Move the given process from the background to the foreground. |
Colaboration Required
Do you want help with this cheatsheet |
|
|
Created By
firepage.cz
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets