Skip to content
poudels14 edited this page Oct 1, 2014 · 1 revision
  1. Bash

    Bash a command-line interface in Linux-based OSes. Some Linux-based OSes are Ubuntu, Arch Linux, Fedora, MAC, Android, and on and on. From writing powerful programs to using it as medium to run other softwares, Bash comes handy in lots of cases. Now, open up your Terminal and do some stuffs.

    Basic Bash Commands:

    1. echo: echo "Hello there"

    This prints 'Hello there' to Bash Shell.

    1. echo "Hello buddy" > file.txt echo "Hello buddy" > file.txt

      Writes "Hello buddy" to file file.txt

    2. cat file.txt cat file.txt

      cat file.txt

    Print content of file.txt to Bash Shell

    1. ls: ls

    Lists files and directory in current Folder

     > `ls -a` > Lists hidden files as well. Remember, files and directory that starts with "." are hidden in Finder/ File Explorer.
    
     > `ls -l` > Lists files with details like when was file created, how large file is, and the like.
    
     > `ls -la` > Does same as `ls -l -a`
    
    1. cd: cd Desktop

    Change Directory. In above you will move to Desktop folder. Remember Desktop should appear when you do ls in that folder.

    cd ~ > You will go to current user home folder. Remember every user has their own home directory.

      > `cd ..` > Move one directory backwards.
    

    cd / > Go to root directory. Remember this folder contains entire files in you computer. This is VERY dangerous region. Don't you anything in this folder is you don't know what's going on.

    1. pwd pwd

    Prints which directory you are currently in

    1. touch: touch newFile.txt

    Creates a new file named "newFile.txt" in your current directory.

    1. mkdir: mkdir newDir

    Creates a new directory named newDir in your current directory.

    1. rm file.txt: rm file.txt

    Remove file named file.txt > rm file1.txt file2.txt > This removes multiple files.

    1. rm -r dir1 > Remove directory named dir1: -r is recursive call. It means remove everything inside that directory recursively.

    2. cp cp file.txt NewDir/Backup/

    copy file.txt in directory NewDir/Backup. Remember you need to have Backup folder inside NewDir. NewDir should be in current directory.

    1. mv mv file.txt NewDir/Backup/

    move file.txt in directory NewDir/Backup. Remember you need to have Backup folder inside NewDir. NewDir should be in current directory.

    Advance 13. ssh username@host: ssh [email protected]

       > Login in to remote computer using ssh-tunnel. If you have SEAS account, try doing `ssh [email protected]`. After you enter your SEAS password, you will get into ENIAC computer. Whatever you do now is done in ENIAC and result are sent to your computer. You will also notice that you you can see what files are there in your ENIAC account. 
    
        > Warning! All your SEAS emails are saved somewhere here, so don't remove anything that you might think is crap. Funny story, once I made this directory as Read-only and no emails reached me until I figured out problem two days later.
    
    1. scp file1.txt username@host:~ scp file1.txt [email protected]:~

      This copies file in your computer to ENIAC.

    Do lots of googling. Google is your way to success.

Clone this wiki locally