Linux PUTTY Commands
for debian & ubuntu apt-get f remaining fedora,centos, redhat uses yum repository Linux commands related Apcher server service apache2 Restart for apache 2.4
service apache2 Reload (not restarts the server just reloads the configuration file) apachectl configtest (checks the syntax errors to avoid startup failure)
for old version of apache just replace httpd with apache2 or apache. More commands on apache page. enable disable modules, vim editor & nano editor etc.
To change directories: cd /path/to/your/directory To delete a file: rm filename To delete a directory: rm -rf directoryname To unzip a zip file: unzip filename To unzip a tar.gz file: tar -xvzf filename To zip a file: don't know - try "man zip" To change up one directory: cd .. two directories: cd ../..
For listing Folders.... use "ls" instead of "dir" For Entering into Directory.. cd folder_name For going back to root... cd for going back one step... cd ..
To delete a whole folder and its content recursively, you can use: rm -rf foldername/
To delete all files/folders in the current directory, without deleting the directory itself, you would need to use: rm -rf *
Navigating directories cd …change directory, method used for moving from one folder to another. cd foldername/foldername2 …would take you to foldername2. cd .. …moves up one directory. cd / …moves you to root. pwd …prints to console your present working directory – where you currently are. List contents ls …list contents of current directory. ls -l …shows long format inc. group owner, size, date modified, permissions. ls -a …shows ALL files inc. hidden files. ls -R …lists contents of sub directories recursively. ls -la …the above options can be used at the same time. ls foldername/foldername …list items in folder without actually moving to it. Creating files and directories/folders touch file.html …use the touch command to create files. rm file.html …use the rm command to remove a file. mkdir myfolder …use the mkdir command to create a new directory/folder. rmdir myfolder …use the rmdir command to remove a directory/folder, folder must be empty. mv folder1/file.html folder2/file.html …use the mv command to move a file. Can also be used to rename a file. Compressing and backing up files and folders zip -r foo.zip foo/ …compress the folder ‘foo’ and all of its contents into a zip file called ‘foo.zip’. zip foo.zip foo.html …compress the file’foo.html’ into a zip file called ‘foo.zip’. File and directory/folder permissions and ownership chmod 755 file.html …changes the file.html file permissions, same for a folder. chmod -r 755 myfolder …changes permissions for that folder and all folders and files inside it recursively. Here are the chmod octal numeric values 700: only owner can read 755: everyone can read but not write 775: only group can read and write 770: no-one but group can read 666: everyone can read and write 1777: everyone can read,write,execute chown user:myself file.html …changes the ownership of file.html to the user called ‘myself’.
check disk space linux
- du disk used
- df -h
Vim Editor commands
vi editor save and quit command
o get into it, press Esc and then : (the colon). The cursor will go to the bottom of the screen at a colon prompt. Write your file by entering: w and quit by entering, :q. You can combine these to save and exit by entering the command: wq
vim editor exit without saving
or crtc+c :q!
sudo nano /etc/apache2/mods-available/evasive.conf
CTRL+W to find, CTRL+X = exit with save type yes or no.