Basic Linux Commands (revision 130718-r01)

Return

List of commands in this tutorial:
  • General Pattern: command space option space target
  • cd [directory_name]: enter directory [directory_name].
    • cd ..: exit one level from current active directory.
  • chmod [option] [target_name]: change file or directory access permit (read, write, execute).
    • *chmod -700 [file_name]: change the file access permit (7 for ourself which means we can read, write and execute, first 0 for group and second 0 for public which means no access at all).
  • ls: list current directory content.
    • ls -al: list current directory content with detailed status.
  • command > [target_file]: do the command, and insert the result to [target_file].
  • mkdir [directory_name]: creates a new directory named [directory_name].
  • more [text_file]: see the content of [text_file].
  • rm [file_name]: delete file [file_name].
  • rmdir [directory_name]: delete directory [directory_name]. This command can't be done if directory has content.
    • rm -rf [directory_name]: delete directory [directory] and all the content.

Basic Linux Tutorial

  1. Do the tutorial in Terminal in your Tiny Core in Virtual Box.
    Assumption: in the end of each command, you press Enter key on your keyboard.
  • List your home directory content:
    $ cd
    $ pwd
    $ ls
    $ ls -al
  • Create a new folder named kuliahos in your home directory. Type:
    $ mkdir kuliahos
  • Create three sub-directories in the kuliahos directory. One of the directories is your NPM. Type:
    $ mkdir kuliahos/1202000818/ kuliahos/test1/ kuliahos/test2/

    (change 1202000818 with your NPM!).
  • Enter directory kuliahos and list the content! Type:
    $ cd kuliahos/
    $ ls -al
  • Delete folder test1 and test2. Type:
    $ rmdir test1/ test2/
  • Please check the rest of the folder content. Type:
    $ ls -al 

  • Go into your NPM directory. For example:
    $ cd 1202000818/
  • Create a new directory named Lab00. Type:
    $ mkdir Lab00
  • Go into directory Lab00.
    $ cd Lab00
  • New let's try to insert ls-al command into a file named dirlist.txt.
    $ ls -al > dirlist.txt
  • See the content of dirlist.txt
    $ cat dirlist.txt
  • Change the access permit of kuliahos to be accessible by anyone, but dirlist.txt can be accessed only by you.
    $ chmod -R 755 /home/tc/kuliahos/
    $ chmod 700 dirlist.txt
    $ ls -al
  • You'll see the access permit change in front of the dirlist.txt line.
    -rw-r--r--
    becoming
    -rwx------

  • Now we will se the IP that is given by Virtual Box and put it in dirlist.txt.
    $ ifconfig
    $ ifconfig eth0 >> dirlist.txt
    $ cat dirlist.txt
  • Exit directory Lab00. You will return to your NPM directory.
    $ cd ..

This is the end of Basic Linux Commands Tutorial.

FAQ:
  1. Q: Haelp me Superman! I was strolling around directories in Tiny Core and now I'm confused on where my home directory is!
    A: Your home directory is /home/tc/, access it with:
    $ cd /home/tc/

    Or just close the current terminal session and start a new one.

Return
Back to WIKI