Unix commands

From NoskeWiki
Jump to: navigation, search

About

NOTE: This page is a daughter page of: Unix


If you're like me you're always forgetting the format and arguments of useful Unix commands like chmod, find, grep and so on.... so here I've compiled a list of some useful examples of commands I often forget.


Commands

man

  • man grep
    • Displays the man (manual) page for the command "grep". From here use the keys:
    • [f] go forward one screen, [b] go back one screen, [q] exit back to command prompt

ls

  • ls -la
    • List all files in current directory in "long list" format - letting you see permissions and file sizes (and a shows hidden files).

find

  • find . -name "myfile.txt"
    • Finds all files named "myfile.txt" in the current directory

grep

  • grep "unix" *.htm
    • search all .htm files in the current directory for any reference of unix

chmod

  • chmod -R 777 directory
    • Allows everyone (user[u], group[g] and world[a]) read[r], write[w] and execute[x] permission
  • chmod a+rw myfile.htm
    • Gives read and write permission to everyone

kill

  • kill -9 1734
    • Run top to get process id '1734' then terminate it - the '-9' makes it more powerful


Programs

pico

  • pico ~/.cshrc
    • Opens the file"~/.cshrc" for editing (even if the file doesn't exist). Once open use the commands:
    • [ctrl+o] to save (write out)
    • [ctrl+x] to exit


See Also

Links