Cheatsheet2 0
Cheatsheet2 0
s. cat file view file, scrollable. cat > file create filename, + enter text. diff file1 file2 show differences. sdiff file1 file2 show side by side. sort file1 > file2 sort file 1, save as file2. sort -o file file replace file with sorted. touch file update file. head file output first 10 lines of file. tail file output last 10 lines of file. Search
Permissions | owner | group | world | d | rwx | rwx |rwx | | | | filetype | | |-- execute 1 .* - file | |------ write 2 d - dir |--------- read 4 l - link chmod 777 read, write,execute for all. chmod +x filename exectue for all. Chmod u+rwx user rwx. System Info
find filespec find file with filespec. uname -a show kernel info. grep pattern file search for patten in file. cat /proc/cpuinfo cpu info. grep -r pattern dir search entire dir for cat /proc/meminfo memory info. pattern. whereis app show possible locations for locate file find all instances of file. which app show which app is default. Pipes Keyboard Shortcuts
command > file output to file. Ctrl+C halts current command. command >> file add output to end of Ctrl+Z stops current command. file. Ctrl+D log out of current session (exit). command < file use file as input. Ctrl+W erases one word in line. command < file1 > file2 combo. Ctrl+U erases whole line. command | command pipe one command Ctrl+R bring up a recent command. to another. Process Management ps display active processes. top display all running processes. kill pid kill process id. bg lists stopped or bg jobs. fg brings most recent job to foreground. fg pid bring pid to foreground. Install ./configure make make install dpkg -i pkg.deb Debian. rpm -Uvh pkg.rpm Redhat. Compression tar cf file.tar files make file.tar from files. tar xf file.tar extract file.tar tar.gz add z to above. tar.bz2 add j to above. gzip file compress and rename file to file.gz. gzip -d file.gz decompress file.gz to file.