Useful Linux Commands
Frequent questions from clients hosted on our Linux servers regarding quick ways to acheive common task to manage their servers and the files on them have prompted this post.
Here are a list of useful server commands that can be used for those of you running Linux servers, and also will mostly work on Unix too. Root access maybe needed for some of these commands depending on your setup.
Change owner of files and directories
# chown -R user /dir/you/choose
-R
If a pathname on the command line is the name of a directory, chown changes all the files and subdirectories under that directory to belong to the specified owner (and group, if :group is specified). If chown cannot change some file or subdirectory under the directory, it continues to try to change the other files and subdirectories under the directory, but exits with a non-zero status.
Set permissions of all directorys, not files
find . -type d -exec chmod 777 {} \;
The above command changes permissions of all sub directories under the current directory... and doesn't effect files however. Make sure you cd to your directory first, doing this from / is a bad idea.
Check what processes are eating memory and CPU in Linux or Unix
top
The above command will list the most CPU-intensive processes running on your system in live time, as the processes change so does the information displayed. Newer linux installations also list memory useage on the same screen. You can delay the live updates if its all a bit fast by adding the -d flag.. for example, to delay screen updates by 10 seconds use:
top -d 10
More useful commands coming soon ... If you wish to request a command, please do so.
