Powered by Blogger.

Linux Commands You Need to Know as Web Developer

Linux Commands You Need to Know as Web Developer

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 characters r-- belong to group permission.
    the third 3 characters r-- 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


Bannerad

Artikel Terpopuler

Tags

Blogumulus by Roy Tanck and Amanda Fazani