lang="en-US"> Useful Linux Commands –  Design1online.com, LLC

Useful Linux Commands

Locate PHP error logs on the server

grep 'error_log' /etc/php.ini | awk -F= '{ print $2; }'

Restart your bash_profile

. ~/.bash_profile

Change to your home directory

cd ~

View your history

history 50

Search your history

Ctrl+R then type what you're looking for

Search files in a directory

grep -Rn what_your_looking_for path_to_directory_you_want_to_search

Change file permissions

chmod filename_here permissions_here

Change permissions for all files in a directory

chmod -R path_to_directory permissions_here

Edit crontabs

crontab -e

Restart apache service

service httpd restart

Restart apache

/etc/init.d/httpd restart

Figure out which directory you’re in

pwd

List all files and hidden files in a directory

ls -la

Auto-complete path file names

start typing the file name in the directory then hit the tab key. Hit it twice to show all files matching what you've typed so far

Display a part of a file without opening an editor

cat path_to_file

Extract all files from a .tar.gz archive

tar -zxvf path_to_archive.tar.gz

Move a file or folder directory

mv path_to_file new_path_to_file

Remove a file

rm path_to_file

Remove a folder directory

rm -Rf path_to_folder

Create a folder directory

mkdir path_to_folder_you_want_to_make

Copy a file

cp path_to_file path_to_file_copy

Copy a folder directory

cp path_to_folder path_to_folder_copy

View help files for a command

man command

You may also like...

Leave a Reply