What should a longtime Windows user know when starting to use Linux? *

Question

We've finally moved our websites to a decent host, and for the first time we have Shell Access.

I know very little about using Linux, I can navigate through the file system, read files with Vim and I'm aware of the man command, and I have been able to work out solutions to problems as they show up (eventually), but I know I'm unaware of a lot.

Edit: We currently only use the host to hold our live sites, I'm sure that we use it more effectively, but I'm not sure where to start.

So with Web Development in mind:

  • What are the essential commands that every Linux user should know about?
  • What are the most useful commands that I should look into?

Answer

If you only have shell access to your host, a number of issues are already taken care of for you, (you don't have to maintain the system yourself).

The useful commands depend on what you primarily want to do, such as interacting with your source control system via command line (you do use source control, don't you?) You already know how to use vim and navigate through the filesystem using cd and ls, so that is a great start.

Most useful commands:

  • ls
    • list files in current directory (like Windows dir)
  • cd
    • change directory
  • cp
    • copying file(s)
    • example:
      $> cp {file1} {file2}
      $> cp /home/jms/file1.txt /home/jms/file1-copy.txt
  • mv
    • moving or renaming file(s)
    • example - rename file1.txt:
      $> mv {file1} {file2}
      $> mv /home/jms/file1.txt /home/jms/file_1_new_name.txt
    • example - move file1.txt:
      $> mv /home/jms/file1.txt /home/jms/myfiles/file1.txt 
  • man
    • see the manual pages for a command
    • example:
      $> man woman
      $> Segmentation fault (core dumped)
  • find
    • search through directories recursively (and optionally perform some action for each match)
  • grep
    • search for pattern matches
  • wc
    • word count / character count / line count
    • example: counting the files in a the current directory (uses ls and wc)
      $> ls | wc -l
    • example: count the files that contain .txt in your home directory (uses find, grep, and wc)
      $> find /home/jms | grep *.txt | wc -l
  • less
    • lightweight file viewer
  • head
    • see the first few lines of a file
  • tail
    • see the last few lines of a file (useful for realtime logging)
    • example: monitor a logfile as logging occurs while an application is running
      $> tail -f /var/log/somelogfile.log
  • passwd
    • change your password
    • example: will act on current user and prompt for old/new password
      $> passwd
    • example: will change password for the user named someuser
      $> passwd someuser
  • ssh
    • secure shell for logging into remote systems
  • touch
    • set file "last modified" time to now (creates a new file if none exists)
  • rm
    • remove a file
    • can also remove files and directories recursively
  • mkdir / rmdir
    • create or remove a directory
  • df
    • check free disk space on volumes
  • du
    • check used disk space on a directory (recursively)
  • ln
    • make a new file/directory that is a "link" to another (such as a symbolic link)
    • example (symbolic link):
      $> ln -s /path/to/destination
  • kill
    • kill/stop a running process
  • chmod, chown
    • change permissions / ownership for files.
  • sudo
    • run a command with superuser (ie "root") privileges
    • your web host may not give you permission to do this
  • vi
    • a text editor included with every linux installation

A number of these items you will have an easier time learning by experimentation.

A very comprehensive guide to bash scripting might also be of use.

< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/1576/" >What should a longtime Windows user know when starting to use Linux?< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment