some stuff I still need to memorize
c-a | move to beginning of line |
---|---|
c-e | move to end of line |
c-k | delete until end of line |
c-w | delete the previous word |
c-r | reverse-i-search (fuzzy search through command history) |
grep -lir "my search string" * | grep r: recursive, l: list files but not lines, search string, directory: \* is current, otherwise app/src/\* or whatever |
history | grep my_search_string | search through bash history |
ls | grep my_search_string | search through directory for file/folder names |
cat my_file_name.txt | grep my_search_string | search through file for text |
ps -ax | grep my_process_name | search through process list for a process like apache or mysql to see if it's running. then kill 123 or whatever the process id is |
cat my/path/to/file.txt vim !$ | Load the last arguments with the current command. Bang, cash! |
mkdir -p a/b/c/ | make the entire path a/b/c/ even if a or b don't exist yet. |
top | shows the most expensive programs at the top. %cpu, %memory, time |
yum search sdffsdlkjf | search for packages with sdffsdlkjf in the name |
scp myfile myshortcut:~/ | copy a file in the current dir called myfile to the ssh configured connection into homedir/. |
reboot | reboot the server... usually requires root |
dmesg | Special log before console was available. Shows log of startup procedures. |
ps aux | awk -F ',' '{print $1}' | pipe ps aux result to awk, which will split based on whatever you put after -F (default is space, leave off -F for space) and the third part print the delimited part. |
ps aux | awk '{ if ($1 == "mfunk") {print $2} }'g | pipe ps aux to awk, which searches a space delimited split of each line for the first item being 'mfunk'. print the second delimited element. |
cat myfile1.txt myfile2.txt > mynewfile.txt | concatenate two files to a new file |
watch | ... |
find | ... |
sed | ... |
df -H | display free disk space. -H is human readable format in base 10. |
tar -zcvf destinationfile.txt.tar.gz fromfile.txt | compress file with .tar.gz |
tar -zxvf compressed_file.txt.tar.gz | decompress file with .tar.gz (or .tar.bz2, or .tgz) |