As web developer, somewhere along the line, you’ll meet unix or linux shell. For those who never use unix/linux before, it could be frustate to deal with shell command.
For a simple thing as list files in current directory to extract zip files. So here a quick list commands you probably need for your next journey. In my opinion, it won’t hurt you to learn some of linux shell commands. Take a quick look, and maybe you have familiar with some of them.
- chmod – change permission of a file or directory
Linux has something called permission on file or folder.
r – Read permission. Permission to read a file or browse a folder
w – Write permission. Permission to write to file or create new file in the folder
x – Execute permission. Permission to execute file
$ls -al -rw-r--r-- 1 gchandrasa gchandrasa 43 2009-02-15 15:00 sample.txt
the first 3 characters after -,
rw-belong to users permission.
the second 3 charactersr--belong to group permission.
the third 3 charactersr--belong to others user permission.One way to change this permission is using the number
r = 4
w = 2
x = 1
So if you want to change the sample.txt permission to others, give read and write permissions.
r = 4 and w = 2, so rw = 4 + 2 = 6$chmod 646 sample.txt
Give read and write permission to users, read permission to group, and read and write permission to others.
- cd – change directory
Use this command to change your current directory.
Example : you need to change directory to Documents$ cd Documents
- cp – copy files and directories
Example : copy file index.php from directory a to directory b$ cp a/index.php b/
- ls – list files in a directory
Example : list files in current directory$ ls
Example : list files in current directory, and show hidden files.
$ ls -a
- man – display manual for a command
$ man mv
- mkdir – create new directories
$ mkdir newfolder
- mv – move (rename) files
Use this command to move your file(s) or to rename file(s).$ mv oldfolder newfolder
- rm – remove files or directories.
Delete all files with extension jpg in current directory.$ rm *.jpg
- tar – The GNU version of the tar archiving utility
Untar and extract file$ tar -xvf test.tar.bz2
- unzip – list, test and extract compressed files in a ZIP archive
Extract file zip$ unzip test.zip
Did I miss something?
More information
Don’t miss a thing, subscribe to our feeds. Or follow us on Twitter.
Related posts:
- Web Development Tools in Linux
- 10 Steps to Becoming a Great Web Developer
- CakePHP Tutorial:Installing CakePHP on Ubuntu
- My First Step Into MongoDB – Installing MongoDB on Ubuntu
- Why We Need Version Control
Tags: linux
[...] the original post: Linux Commands You Need to Know as Web Developer Nessun tag per questo [...]
[...] Linux Commands You Need to Know as Web Developer | KomunitasWeb Author: admin Time: Monday, April 6th, 2009 at 8:19 am Category: DESIGN, LINUX/UNIX [...]
Most likely you’d poke around various log files which in most linux variants are found under /var/log/
“less” is a cool tool frequently used to view even large files
“tail” tail is capable of viewing the “back” of a file meaning from the last lines. “tail -f” will keep showing you the newest lines appended to the file.
“grep” is extremely useful to find specific words or patterns in both files and in piped data. E.g. “grep SomeWord myfile.txt” or “cat myfile.txt | grep “SomeWord”
“awk” is a useful language for handle more complex scenarios, also in conjunction with pipes.
well – the list just goes on and on…
Don’t forget wget – grab web pages from the command line. Invaluable when you want to see what your browser is really getting from the server.
if you know to server is working,maybe “nmap” is useful for the checking port. :p
You’ll probably want to add “find” and “grep”. Amazingly useful for web development. You can easily find good tutorials from my site if you like.