1) How to check list of available files on directories
ls ---- list of files
ls -l --- Long list files
ls -ltr ---- for latest files will comes last
2) How to know current working directory?
pwd
ex:
root@localhost Desktop]# pwd
/root/Desktop
3) How to check file system size
df -h
ex:
root@localhost Desktop]# pwd
/root/Desktop
4) How to check disk utilization
du -sh
5) Copy command
cp sourcefile destinationfile
6) move command
mv sourcefile destinationfile
Also Check for Latest Videos on Weblogic training tutorials videos here:
7) change permission
CHMOD can also to attributed by using Numeric Permissions:
400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody
more info: http://www.linux.org/threads/file-permissions-chmod.4094/
8) Change ownership permissions:
chown username:groupname file/directory
more info: http://www.cyberciti.biz/faq/how-to-use-chmod-and-chown-command/
9) If you want to change some parameter in a file using sed:
sed -i s/oldparameter/newparameter/g filename
10) killing some process id:
kill -9 pid
pid: process id
11) How to update Local file system hierarchy ?
dbupdate
12) How to find any files using some pattern?
locate test.txt
locate test
locate jdk_
13). How to check running java process?
ps command
ex: ps -ef | grep java
14). How to check running jvm process port number?
netstat -tulnp | grep java
15) How yo create Linux user?
useradd username
ex: useradd test
16) How to delete linux user?
userdel username
ex: userdel test
17) uptime --- To know system load and server running time from server start.
ex:
localhost ~]# uptime
16:48:27 up 8 min, 3 users, load average: 0.07, 0.18, 0.13
[root@localhost ~]#
18) top --- To know linux system tasks.
localhost ~]# top
top - 16:50:19 up 10 min, 3 users, load average: 0.06, 0.14, 0.13
Tasks: 147 total, 1 running, 142 sleeping, 4 stopped, 0 zombie
Cpu(s): 0.0%us, 0.3%sy, 0.0%ni, 58.5%id, 41.2%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1011428k total, 486260k used, 525168k free, 45816k buffers
Swap: 2031612k total, 0k used, 2031612k free, 161472k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2452 root 20 0 98.1m 4332 3356 S 0.7 0.4 0:00.23 sshd
10 root 20 0 0 0 0 S 0.3 0.0 0:03.13 rcu_sched
2077 root 20 0 45148 764 440 S 0.3 0.1 0:00.05 udisks-daemon
2516 root 20 0 15080 1236 904 R 0.3 0.1 0:00.19 top
1 root 20 0 19416 1540 1232 S 0.0 0.2 0:01.64 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/0:0H
6 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 kworker/u:0H
8 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
9 root 20 0 0 0 0 S 0.0 0.0 0:00.00 rcu_bh
11 root RT 0 0 0 0 S 0.0 0.0 0:00.01 watchdog/0
19) history --- You will get history of your previous commands.
ex:
[root@localhost ~]# history
1 useradd testuser
2 passwd testuser
3 uptime
4 man top
5 top
6 man top
7 clear
8 history
[root@localhost ~]
20) how to run a shell script as back ground process?
Ans) ./test.sh &
if you give a shell script after space and give '&' symbol, then this script will run on as background
process.
21) If you want to run a shell script as background process and also if you want to collect output from running shell script, how to it?
Ans) nohup ./test.sh &
nohup is a command to collect all your shell script related output to save into "nohup.out" file. This
file will be located on same directory, once you execute this command.
22) Crontab command ?
Crontab is useful to schedule any jobs from your linux server.
checking how many jobs currently running on your linux box/server:
->crontab -l
Checking jobs based on user on your server:
->crontab -l -u testuser
Adding cronjob using:
-> crontab -e
Adding Cronjob using user:
-> cronjob -e -u testuser
how to add parameters into crontab:
You can edit on crontab like this:
30 08 10 06 * /home/test/test.sh
- 30 – 30th Minute
- 08 – 08 AM
- 10 – 10th Day
- 06 – 6th Month (June)
- * – Every day of the week
On below example, i want to daily nullify (removing content from test.log file) test.log file at 11pm.
ex:
* 23 * * >/root/test.log
Note: While editing under crontab, for each option you need to provide TAB button (you will get from your keyboard) space.