Dir Commands:
$ mkdir <dirname> //Create directory
$ cd <dirname> //Change directory
$ cd .. //Back to directory
$ mv <old directory name> <new direcory name> // Renaming directory
$ rmdir <dirname> //Remove Directoryax
File Commands:
$ cat >> <file name> //Create file
$ cp <path/filename> <path/filename> //Copy file
$ mv <old filename> <new filename> //Rename file
$ rm <filename> //Delete file
$ rm -f <filename> //Force delete file
$ rm -r <filename>> //Recursive delete
$ nano <path/filename> //Edit a file
File Listing Commands:
$ ls //Listing of files
$ ls -a //Entries starting with .
$ ls -l //Detailed
$ ls -s //Size
Networking Commands:
$ /etc/init.d/networking restart //Restart networking
$ ip route show | grep ^default //Get default route
$ route add default gw <gateway> <network interface id> //Add default gateway
$ ufw disable //Disable firewall
Disk Commands:
$ df //Disk free
$ du //Disk used
$ free //Show RAM swap space
Other Commands:
$ date //Date and time
$ cat <file name> //Reading file content
$ grep <search text> <filename> //Search text within a file
$ find <filename> //Find file
$ find / -size +10M //Find a file for a specified size
$ top //Show all processes
$ ps //Show owner started processes
$ kill <process id> //Kill a running process
$ reboot //Reboot system
$ shutdown //Shutdown system initiate after 30 seconds
$ shutdown <time> //Shutdown system after a specified period in seconds
$ gzip <files> //Creating zip file
$ gunzip <zip filename>
$ echo -e "AT\r" > <device name> //Writing to a device
$ cat < <device name> //Reading from a device
$ stty -F <device name> <baud rate> //Setting baud rate
$ lsusb //List of USB devices
$ apt-get install <package name> //Installing package
$ apt-get remove <package name> //Uninstalling package
$ update //Update system
$ upgrade //Upgrade system
Changing File Ownership:
$ chown owner-user <filename> //Changing file ownership
Changing Directory Access Permissions:
Syntax: $chmod <options> <user type>+<access type> <file path>
User Type: a=all, u=user, g=group, o=others
Access Type: r=read, w=write, x=execute
Example:
$ chmod a+rwx /example //Access permission of directory
$ chmod -R a+rwx /example //Recursive access permission of directory
Changing File Access Permissions:
Syntax: $chmod <access permissions> <path/filename>
$ chmod 777 /example/test.txt //Changing file permission