Posts Tagged With: cli

Create a Directory Tree in One Command

Tagged with: , , , , , ,

You can create a directory tree using just one command in Linux


mkdir -p /tmp/dir1/dir2
No Comments »

Using Range in Commands

Tagged with: , , , , ,

Show files and directory containing numbers


ls *[0-9]*
No Comments »

Commands for Idle Time

Tagged with: , , , ,

I run this command when I go for lunch or something - these commands take a while to run.


sudo /bin/bash /usr/sbin/makewhatis -w; sudo /usr/bin/updatedb; sudo /home/binnyva/Software/System/chkrootkit-0.47/chkrootkit
No Comments »

lsmod - Show Loaded Kernel Modules

Tagged with: , , , , ,

This command shows the kernel modules that are currently loaded.


# lsmod

Module                  Size  Used by
vboxdrv                55088  0
autofs4                20421  2
ipt_MASQUERADE          6721  1
iptable_nat             9669  1
nf_nat                 18669  2 ipt_MASQUERADE,iptable_nat
nf_conntrack_ipv4      11717  2 iptable_nat
nf_conntrack           51977  4 ipt_MASQUERADE,iptable_nat,nf_nat,nf_conntrack_ipv4
....
No Comments »

Show Disk Usage - du

Tagged with: , , , , , ,

du shows the ‘disk usage’ - the space taken up by the files and folders in the current directory.


du -bh | more
No Comments »

free Command

Tagged with: , , , ,

free gives the Memory info (in kilobytes).


free
#Output
             total       used       free     shared    buffers     cached
Mem:       2075000     667508    1407492          0      25988     352076
-/+ buffers/cache:     289444    1785556
Swap:       979924          0     979924

[tags][/tags]

No Comments »

last Command

Tagged with: , , , , , , ,

The last command shows a history of logins…


last
No Comments »

Finger Command

Tagged with: , , , ,

System info about a user. Try: finger root. An admin needs it all the time


finger user_name
#finger root
Login: root                             Name: root
Directory: /root                        Shell: /bin/bash
Last login Tue Nov 27 20:19 (IST) on tty1
No mail.
No Plan.
No Comments »

Run a Command if Another Command Succeeds

Tagged with: , , , , , , ,

This will let you run a linux command based on the success of anther command. Note: This will only work in bash shell.


ruby Create_PDF.rb && if [ $? == 0 ]; then kpdf report.pdf; fi
No Comments »

Sort a File

Tagged with: , , , , ,

A Linux command to sort the contests of a file


sort file.ext

[tags][/tags]

No Comments »