Skip to content

Instantly share code, notes, and snippets.

@wisecrab
Last active February 17, 2016 13:56
Show Gist options
  • Save wisecrab/858ac7bf00890d948cf6 to your computer and use it in GitHub Desktop.
Save wisecrab/858ac7bf00890d948cf6 to your computer and use it in GitHub Desktop.
A collection of useful terminal commands to use in linux.
//Check if packages are installed
dpkg --get-selections | grep [package_name]
//Show a list of files and directories in the current directory.
ls
//Show file permissions
ls -l /avr/www/html/index.php
//Edit a file
nano /var/www/html/file-name.php
/********************************
*** Directories ***
********************************/
//Copy a file
cp file-name copied-file-name
Copy a directory
cp -r folder copied-folder
//Move or rename a file
mv: The mv command will move a file to a different location or will rename a file. Examples are as follows: "mv file foo" will rename the file "file" to "foo". "mv foo ~/Desktop" will move the file "foo" to your Desktop directory, but it will not rename it.
//Delete a file
rm file.txt
//Delete an empty directory
rmdir folder-name
Delete directory and all files/folders in it
rmdir -r folder-name
//Create new directory
mkdir directory-name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment