My first experience with Linux started when i setuped a server for one my client. It was monumental task for me at that time. I was very happy mouse driven windows user. When I came to the world of putty I was lost. So I had to search for certain commands. I recently written the Setup LAMP With Ubuntu In 10 Minutes. One of my colleague trie to setup LAMP following that post. He was also happy mouse driven windows user So he was having problem with commands. So in this post I am showing all the commands I need and used to use Linux server. I will post all the problems i faced using LAMP in next post. Be sure to subscribe my blog.
To create new directory
mkdir target_director
To copy an entire folder (directory tree) in Linux
cp -ap /var/lib/mysql /mnt/mysql -ap for same permission as source
For checking the size of current folder
du -ch | grep total
To find the size of the hdd
just enter df
To find out the size of the folder in the folder
du du -a to show all the file's size
See all files and their size
du -s * -h
To output the number of files in the current directory
ls | wc -l
See all the jobs
ps -aux
To find out RAM size on Linux machine
free
Rename folder/filename
mv test hope mv *.rtf *.txt
To find which process is consuming how much RAM?
top
To see the free ram memory
free -m
To update yum using corn
0 21 *** usr/bin/yum -y update
Create tar.gz file
tar czvf myfolder.tar.gz abcfolder/
Untar a tar file
tar czvf myfolder.tar.gz abcfolder/
[/sourcecode]
Delete bash History
Try to delete the content of ~/.bash_history
To add new user
* Adding a new user (useradd)
* Modifying an existing user (usermod)
Options:
* -d home directory
* -s starting program (shell)
* -p password
* -g (primary group assigned to the users)
* -G (Other groups the user belongs to)
* -m (Create the user’s home directory
useradd -gusers -Gmgmt -s/bin/shell -pass -d/home/jambura -m jambura
User’s home directory should be 700. If you are operating a ~username type server, the public_html directory should be 777. You may also need to open up the home directory to 755.
useradd -s/bin/bash -pass -d/imp/sysbsd -m sysbsd
For allowing sudo
sudo adduser jambura admin
To delete user
userdel user
To display your crontab file
crontab -l
root can view any users crontab file by adding “-u username”
crontab -u bappy -l # List bappy's crontab file.
* * * * * Command to be executed
- – – – -
| | | | |
| | | | +—– Day of week (0-6)
| | | +——- Month (1 – 12)
| | +——— Day of month (1 – 31)
| +———– Hour (0 – 23)
+————- Min (0 – 59)
Field Allowed values
—– ————–
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)
To edit crontab file
crontab -e
#change the editor used to edit file set the EDITOR environmental variable like this:
export EDITOR=/usr/bin/emacs
2 Comments until now
[...] Some Important Linux commands for Newbies January 20, 2012 2:58 PM My first experience with Linux started when i setuped a server for one my client. It was monumental task for me at that time. I was very happy mouse driven windows user. When I came to the world of putty I was lost. So I had to search for certain commands. I recently written the [...] [...]
[...] of mail server and fixing necessary problems. Before you start this you should look into these post Some Important Linux commands for Newbies and Setup LAMP With Ubuntu In 10 Minutes. We will setup Postfix (Mail Transfer Agent MTA), Dovecot [...]
Add your Comment!