Skip to main content

Posts

Showing posts from 2013

Command used in day to day activity

Command to find the used ports in server netstat -ln | grep '80 ' | grep 'LISTEN' netstat -atnp|grep LISTEN  netstat -ln | grep '99 ' | grep 'LISTEN'  netstat -ln | grep '16' telnet <machine_IP> <port> Command  for copying files to server  scp -pr RMVServices-0.0.2-SNAPSHOT.war shib@100.1.127.11:/home/shib Command for multiple search   tail -f /tmp/Liferay-JBoss.out |grep 'PAGENAME\|tabName' grep 'PAGENAME\|tabName'  for multiple search Command to set line no in VI Editor :set nu   for line no :/ERROR   for ERROR search in VI grep -r devapp214 ./|grep tst2 Command to shutdown jboss  ./shutdown.sh -s 172.23.2.5:7109 ./shutdown.sh -s 172.23.2.25:1399 Command to search files find ./ -name jboss-admin.sh Command to see difference in  files sdiff  ./pdf.css  /opt/dadm/liferay-portal-6.0-ee-sp2/jboss-.1.0/serv...

Hiding a file or directory under Linux

Hiding a file or directory under Linux To hide a file or directory in Linux, just give it a name preceded by a full stop (.). For example: . bash_history . bash_profile . ssh    Hide UNIX file structure   1. Open a terminal and execut "ls -1 / | sudo tee /.hidden" 2. Do "sudo chmod a+r .hidden" 3. If you want all standard files hidden, skip to 5. Otherwise. Open the file with "sudo gedit /.hidden". 4. Remove every directory you don't want to hide from the file. Here's how mine looks like, as an example: bin boot opt usr etc sys tmp srv proc root sbin lib lost+found mnt initrd dev debootstrap var cdrom initrd.img initrd.img.old vmlinuz vmlinuz.old home media 5. Now, let's create some entries that are easier for new users: select "home" and create a link to link to it (for example, by dragging it and holding <ctrl>+<shift>. Your mouse cursor shou...

Touch & More

Touch touch [-acm] [-f agefile] [-r agefile] [[-t] time] file ... touch [-acm] time file ... DESCRIPTION The touch command changes certain dates for each file argument. By default, touch sets both the date of last file modification and the date of last file access to the current time. This is useful for maintaining correct release times for software and is particularly useful in conjunction with the MKS Make software development facility. Options -a     sets only the access time. -c     does not create any files that do not already exist. Normally, touch creates such files. -m     sets only the modification time. If you do not specify -a or -m, touch behaves as though you specified both. To tell touch to use a time other than the current, use one of the following options: -f agefile    is an obsolete version of the POSIX-compliant -r option. -r agefile   ...

Beginners UNIX Interview Questions Answers

1. Write command to list all the links from a directory? In this UNIX command interview questions interviewer is generally checking whether user knows basic use of "ls" "grep" and regular expression etc You can write command like: ls -lrt | grep "^l" 2. Create a read-only file in your home directory? This is a simple UNIX command interview questions where you need to create a file and change its parameter to read-only by using chmod command you can also change your umask to create read only file. touch file chmod 400 file 3. How will you find which operating system your system is running on in UNIX? By using command "uname -a" in UNIX 4. How will you run a process in background? How will you bring that into foreground and how will you kill that process? For running a process in background use "&" in command line. For bringing it back in foreground use command "fg jobid" and for getting j...