Of Code and Me

Somewhere to write down all the stuff I'm going to forget and then need

A Total Newbies guide to a few Linux commands September 2, 2009

Filed under: Linux — Rupert Bates @ 12:36 pm

This is just a reminder for me really, as I struggle to debug one of our LAMP sites after our Sys Admin left…

cd [directoryname] – Change directory

cd .. – Go up one directory

cd ../.. – Go up 2 directories

ls – List directory contents

cat [filename] – Show the contents of a text file

rm [filename] – Delete a file

rmdir [directory] – Delete a directory

rmdir -r [directory] – Delete a directory and all it’s contents

sh [filename] – Execute a shell script file

Tab – Complete a filename

Ctrl + c – Cancel a running command

crontab -l – List all the current user’s cron jobs

ps -A – List all running processes

ps -A | grep java – list all running java processes

find -name *blah*.zip – Find all zip files with blah in their name, more examples

grep “[string literal]” *.log -C 4 – Search for a string literal in all .log files and return 4 lines on either side of the matching line, more examples

tail [filename] -follow - Show the last 10 lines of a file and watch it for changes (Ctrl + c to cancel)