Presentation is loading. Please wait.

Presentation is loading. Please wait.

AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG.

Similar presentations


Presentation on theme: "AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG."— Presentation transcript:

1 AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG

2 WHAT IS UNIX? Operating system developed in the 1960s Still being developed Usually Command line based Multiuser and multitasking You can read more about UNIX here: http://www.ee.surrey.ac.uk/Teaching/Unix/unixintro.html

3 USEFUL SOFTWARE FOR CONNECTING TO REMOTE MACHINE PuTTY: Free SSH Client – Allows you to remotely connect to another machine in a secure way Filezilla: Free FTP Software – Allows you to transfer files to and from another machine

4 HOW TO GET TO THE TERMINAL IN KALI

5 HOW TO NAVIGATE ls (list) – this command shows all the files and subdirectories of your current directory. ls –hal : better version (human readable, all, long listing format). cd (Change Directory): this command changes your directory to the specified one. Example cd desktop will take you to the desktop directory Example cd.. Will take you to the parent directory pwd (print working directory): shows you where you are in relation to the whole file system.

6 HOW TO CREATE NEW DIRECTORY(FOLDER) mkdir (make directory): Allows you to create a directory(folder) in your current directory Similar to right clicking and choosing new folder in windows Example: mkdir newdirectory

7 HOW TO VIEW CONTENTS OF A FILE cat (concatenate): displays contents of the file to the screen Example: cat randomfile.txt less: displays contents of the file to the screen a page at a time Example: less randomfile.txt [space-bar] to visit next page, [q] to quit

8 HOW TO SEARCH A FILE FOR KEYWORDS Grep: searches files for specific words or patterns Example of searching for the word password in passwords.txt: grep password password.txt Example of searching for a phrase in password.txt: grep ‘my password’ password.txt Example of search for a phrase in a directory: grep -R 'string' dir/

9 UNIX TEXT EDITORS Nano: very simple to use editor, we will be using nano in our tutorial Vim: a bit more complex to use but it is very powerful and very rewarding when mastered

10 HOW TO TOUCH Touch: creates a empty file touch blankfile.txt

11 CREATE A FILE USING NANO nano filename Example c file: nano sample.c Example c++ file: nano sample.cpp Example java file: nano sample.java

12 SAVING A FILE IN NANO Press ctrl-o to save the file Press ctrl-x to exit nano will ask you if you want to save, press y to save press n to not save It will prompt you to enter a file name After editing the file name, you can press enter

13 HOW TO COMPILE A C FILE IN UNIX gcc filename.c This will create an executable called a.out You can run the executable by running./a.out gcc filename.c –o executablename This will create an executable with whatever name you specify You can run the executable by running./executablename

14 HOW TO COMPILE A C++ FILE IN UNIX Very similar to c g++ filename.cpp This will create an executable called a.out You can run the executable by running./a.out g++ filename.cpp –o executablename This will create an executable with whatever name you specify You can run the executable by running./executablename

15 HOW TO COMPILE A JAVA PROGRAM IN UNIX javac filename.java This will create a.class file called filename.class java filename This will run the application

16 HOW TO DELETE A FILE rm filename: deletes the file

17 HOW TO DELETE A DIRECTORY rmdir directoryname: removes the directory rm -rf directoryname: removes the directory and its contents

18 FINAL TEST Create a directory in your Desktop called “CSG Files” Create a file called “basic UNIX commands” and copy the test from http://mally.stanford.edu/~sr/computing/basic-unix.html and save the file http://mally.stanford.edu/~sr/computing/basic-unix.html Search for cp in the file and determine what that command does Use cp to copy the “basic UNIX commands” to your Desktop Delete the “basic UNIX commands” from your Desktop Navigate back into your “CSG Files” directory Create a program to print hello world in your favorite programming language and try it out

19 WANT TO LEARN MORE? HERES SOME GREAT RESOURCES UNIX Tutorial for Beginners: http://www.ee.surrey.ac.uk/Teaching/Unix/http://www.ee.surrey.ac.uk/Teaching/Unix/ Learn UNIX the hard way: https://nixsrv.com/llthwhttps://nixsrv.com/llthw


Download ppt "AN INTRO TO UNIX/LINUX COMMANDS BY: JIAYANG WANG."

Similar presentations


Ads by Google