$ if [ false ]; then echo "That was a true statement"; fi
Compare cert salaries and plan your next career move
hiddenknight821 wrote: » The more I think about it, the trickier it gets. Since I had it partially correct, I believe the `rm -rf' command didn't even execute at all, because it requires root privilege.
hiddenknight821 wrote: » I might as well go ahead and **** to find out... in the VM, of course, you slick, sick, sadist.
ChooseLife wrote: » Not really, "rm" itself doesn't know that it requires a root privilege to finish successfully - it just tries and fails with a "permission denied" message. If I misunderstood what you meant, please tell me.
hiddenknight821 wrote: » After testing it, I was mind-blowned! It didn't execute at all, because 'sudo' cannot find 'cd' command. I'm glad you brought this to our attentions. Like I said, you come up with good trick questions. I'm surprised none of the books I read so far warned me about using built-in shell command with the sudo commands, especially in scripting. So next time something funny like that happen, I'd make sure to use the type/which/whereis commands before I go nuts.
$ sudo bash -c "cd TrashCan && rm -rf *"
[root@station1 ~]# ls -l total 76-rw-r--r-- 1 root root 0 Feb 18 12:10 ~ -rw 1 root root 1253 Oct 17 2011 anaconda-ks.cfg drwxr-xr-x 3 root root 4096 Oct 21 2011 Desktop -rw-r--r-- 1 root root 31401 Oct 17 2011 install.log -rw-r--r-- 1 root root 4919 Oct 17 2011 install.log.syslog -rw 1 root root 11727 Oct 18 2011 mbox [root@station1 ~]#
UnixGuy wrote: » +1 excellent thread! Keep them coming
dontstop wrote: » rm -rf -- \~
rm -- ./\~
[root@station1 ~]# rm \~
[root@station1 ~]# rm ~/\~ rm: remove regular empty file `/root/~'? y [root@station1 ~]# ls -l total 76 -rw------- 1 root root 1253 Oct 17 2011 anaconda-ks.cfg drwxr-xr-x 3 root root 4096 Oct 21 2011 Desktop -rw-r--r-- 1 root root 31401 Oct 17 2011 install.log -rw-r--r-- 1 root root 4919 Oct 17 2011 install.log.syslog -rw------- 1 root root 11727 Oct 18 2011 mbox [root@station1 ~]#
hiddenknight821 wrote: » Well, you got a few options. The best way to be sure that you are doing them properly is to manually create the symbolic links in each desirable run-level directory under /etc/rc.d/ directory. Each symlink has to either start with 'S' or 'K' followed by a number in collating sequence with script name suffix. S is for start and K is for kill. The number is important as you may want to start up the firewall before networking. The chkconfig is doing all the dirty works for us which is implied by the `rpm -ql chkconfig' command. The script file that each symlink is being linked to has to be placed in the /etc/init.d/ directory with all of the applicable case options such as start, stop, reload, restart, and so forth. It's probably best to use an initd script template and build the script from there. Although, I know there is a place in /etc/rc.local where you can throw in any script that you want to run after the host's done booting up, but this wouldn't be appropriate for the iptables service. Beside, the script runs regardless of the run-level you are in.
ChooseLife wrote: » Actually, using S and K files in /etc/rc.d/rcX.d is a fundamental way of managing daemons start/stop in System V-like Linuces (e.g. RedHat) - it is one of the differences between them and BSD-like Linuces (e.g. Slackware). Tools like chkconfig just partially automate/simplify this process.
paul78 wrote: » If I recall correctly - I believe that KVM is a type 1 hypervisor. It runs in the kernel directly on the hardware and exposes the hardware through a device file (can't remember which) for guest systems. It doesn't run an an app in userland which I recall is the definition of a type 2 hypervisor. Something like that
MentholMoose wrote: » Okay this thread is supposed to be "question of the day", so post more questions. IMO it doesn't need to be anything tricky. Question: It's 4:55 PM and you're about to exit your SSH sessions, power off your laptop, and go home, but your boss tells you to download a large file / compile a program / run a lengthy SQL query / etc. on a remote server before you leave so it's ready tomorrow. What should you do in your SSH session to that server to allow the task to continue when you close the session?
root@server1 # nohup /MentholMoose.sh &
UnixGuy wrote: » root@server1 # nohup /MentholMoose.sh &
Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. ... When screen is called, it creates a single window with a shell in it (or the specified command) and then gets out of your way so that you can use the program as you normally would. Then, at any time, you can create new (full-screen) windows with other programs in them (including more shells), kill the current window, view a list of the active windows, turn output logging on and off, copy text between windows, view the scrollback history, switch between windows, etc. All windows run their programs completely independent of each other. Programs continue to run when their window is currently not visible and even when the whole screen session is detached from the user's terminal.
ChooseLife wrote: » Somewhat related to the subject, I want to once again promote a program called "screen":
paul78 wrote: » Followup question - how do you modify this command so that you redirect both stdout and stderr to nohup.out?
root@server1 # nohup /MentholMoose.sh 2>&1 &
root@station1 # ls /var/tmp/*tmp -/bin/bash: /bin/ls: Argument list too long
UnixGuy wrote: » Question: you want to list all files in a directory that ends with *.tmp (so you can move/delete them later), and you got this error:root@station1 # ls /var/tmp/*tmp -/bin/bash: /bin/ls: Argument list too long
find . -name \*.tmp -print
hiddenknight821 wrote: » ...So I'll not see that kind of limitation with today's hardware. . Keep those questions coming!
paul78 wrote: » Hmmm - my guess would be:find . -name \*.tmp -print
Compare salaries for top cybersecurity certifications. Free download for TechExams community.