0% found this document useful (0 votes)
41 views6 pages

Linux

This document provides a summary of common Linux commands for working with files and directories, editing files, compiling code, and more. It lists commands like ls, cd, mkdir, rmdir, cat, cp, mv, wc, man, date, chmod, clear, and pwd for navigating and managing files and folders. It also covers the nano text editor, using gcc to compile C code, and commands like id and whoami.

Uploaded by

om
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views6 pages

Linux

This document provides a summary of common Linux commands for working with files and directories, editing files, compiling code, and more. It lists commands like ls, cd, mkdir, rmdir, cat, cp, mv, wc, man, date, chmod, clear, and pwd for navigating and managing files and folders. It also covers the nano text editor, using gcc to compile C code, and commands like id and whoami.

Uploaded by

om
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 6

ITSC 202:

Linux
Working with Files
• ls -to list all the files and or folders in a current directory by default
Options:
-a: to list all files that are hidden ‘.’
-l: to list in a long format showing file attributes and permission
• ls –a -list all hidden files, starting with ‘.’
• ls –l -gives a long listing showing file attributes and file permissions
drwxrwxr-x 6 hgsjdkdf hdjkcfnd 4096 Sep 14 10:40 test
-rwx-w-r-- 1 hvkhdshjd vhjvhjvgh 140 Nov 17 09:10 test.c
• cd -changes the directory

© 2017, Southern Alberta Institute of Technology


Contd..
• cd . -shows the current directory
• cd .. -take you to the previous directory
• mkdir -creates a directory under the current working directory
• rmdir -removes files
• cat <filename> -displays the content of the file
• cp <sourcefile> <destinationfile> -copy the content of the file(source
file is not deleted/only modified)
• mv <sourcefile> <destinationfile> -copy the content of the file(source
file is deleted)
• wc -counts the number of lines, words, and bytes in the file

© 2017, Southern Alberta Institute of Technology


Commands
• man -help manual
• date -display or change the date
• chmod - used to change the access permission
-used to set the file permissions to users, group, and others
-r=4, w= 2, x=1
• clear -clear the screen
• pwd -print working directory, shows the path of current directory
• whoami -to give the name of logged user
• id -command line utility tool, gives user and group names
• sudo apt update && sudo apt upgrade -to update and upgrade kali

© 2017, Southern Alberta Institute of Technology


Nano Editor
nano <filename> -to edit a file
^G -display a help file with a bunch of information about using nano
^o -write or save the file
^x -exit the program and return to the prompt
^d -delete the character currently under the cursor
^k -delete the entire line
^u -paste text
^\ -search for (and replace) a string of characters

© 2017, Southern Alberta Institute of Technology


Compiling files
For C files

sudo apt-get install gcc


Gcc --help
gcc [options] source_file –o compilefile
gcc myfile.c

© 2017, Southern Alberta Institute of Technology

You might also like