Linux: Miscellaneous Commands 
# Finding users in a specific group
[root@storage1 ~]# getent group wheel
wheel:x:10:dsibitzky

# Sort directory content by size
du -hs * | sort -h

# Grep search showing several surrounding lines (4 before and 2 after)
grep -nir -B 4 -A 2 "Angel Cool" /home

# Grep search showing several surrounding lines (3 before and 3 after)
grep -nir -C 3 "Angel Cool" /home

# python package manager installation PIP (fedora 20)
[aesteban@localhost ~]$ sudo yum install python-pip.noarch

# example of using PIP
[aesteban@localhost ~]$ pip search memcache

# Test Disk I/O Performance With dd Command
[aesteban@localhost ~]$ dd if=/dev/zero of=test.img bs=1G count=1
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB) copied, 4.90908 s, 219 MB/s



Passwordless ssh login - ssh keys setup -copy ssh key to remote server
#generate new key if needed
[aesteban@localhost ~]$ ssh-keygen -t rsa

#copy key to remote server
[aesteban@localhost ~]$ ssh-copy-id root@storage3.example.com

#alternative way to copy key to remote server
[aesteban@localhost ~]$ cat ~/.ssh/id_rsa.pub | ssh root@storage3.example.com "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

# You should now be able to login to remote server without a password


Generate public key from private ssh key
[acool@localhost ~]$ ssh-keygen -f id_rsa_codedeployment -y > id_rsa_codedeployment.pub



Vim Little Corner
//commenting out a block in vim using visual mode
1.- ctrl + v
2.- use keydown to select lines
3.- shift + i (capital i ) // or #
4.- press ESC and give it a second



-----------------------------------------------------------------------------

This is an attempt to create a cleaner version of linux related sutff in :

http://angelcool.net/sphpblog/comments. ... 420-124152

oooo yea!! (òÓ,)_\,,/



Comments
Comments are not available for this entry.
2024 By Angel Cool