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)

Advertisements
 

2 Responses to “A Total Newbies guide to a few Linux commands”

  1. Nik Silver Says:

    Also of use…

    Ctrl + z – Suspend the currently running thing

    fg – Resume the suspended thing and bring it back into the foreground

    bg – Resume the suspended thing but let it run in the background while you carry on doing other stuff


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s