Difference between revisions of "Linux"
From ACL@NCU
Line 86: | Line 86: | ||
apt-cache search libpcre | apt-cache search libpcre | ||
</pre> | </pre> | ||
*[http://sealmemory.blogspot.tw/2011/10/ubuntu-octave.html install octave from source] | |||
= System Configuration = | = System Configuration = |
Revision as of 16:29, 16 June 2013
Useful tcsh and python commands
tcsh
- Find files
with defined stem pattern under multiple different folder
find */*/*anat+tlrc.*
- find files with a suffix recursively under subdirectories
find . -name \*.mgz -print
- delete or copy filenames from a "pattern" search
rm `find */*/*anat+tlrc.*`
- comment multiple lines
:<<LABEL comment line #1 comment line #2 comment line #3 ... comment line #final LABEL
- Extract a substring [1]
- Split a string[2]
The awk function split(,,sep) splits a string into an awk array using the delimiter sep.
set time = 12:34:56 set hr = `echo $time | awk '{split($0,a,":"); print a[1]}'` # = 12 set sec = `echo $time | awk '{split($0,a,":"); print a[3]}'` # = 56
- Translation between bash and tcsh [3]
file system
- Determine file creating and modification times [4]
stat *
Network Connection
- Blocking a port [5]
sudo ufw deny 80
other ufw usage [6]
- Scanning available ports
nmap -PS <IP address>
- Scanning all available IPs in subnet
nmap -sP 192.168.1.0/24
- restart network GUI (allow the top-left icon of network to show up)
sudo service network-manager restart
Install new packages
- pip [7]
sudo apt-get install python-pip python-dev build-essential sudo pip install --upgrade pip sudo pip install --upgrade virtualenv
- apt-cache: search for the name of library package with keyword
apt-cache search libpcre
System Configuration
- reset root password
sudo passwd root