rpm -i "whatever.rpm" --> installs it which gv --> finds where the gv command is whereis stdio --> locates where the source file is ( searches some standard linux directories) find -name ./ --> similar dunno exactly locate --> finds the file nl file > newfile --> numbers the nonblank lines pr -l 60 cpu-monitor.prnt | lpr --> print with page numbers GREP: ------- grep -r SYS_getglobaleventcount * --> recursively search all files under all directories below for the pattern grep -rs sys_call_table * --> grep recursively, but don't print error messages TO SEARCH FOR A SPECIAL PATTERN LIKE [].; DO: grep -r '\[\]' ./LKMs/ To search for a range: grep '[0-9a-zA-Z]' maymun If i wanna find lines with either 'cant' or 'belma' in them, do it like: grep '[cb][ae][nl][tm]' file -------- CTAGS / CALLTIPS: ---------- You can use ctags to build index of where func-ns & vars are defined VERY USEFUL: Beats grepping the hell out of kernel source files USAGE: ctags -R (will build DBase recursively from this folder down) the o/p will be in "tags" file Then you can load it to NEdit: File -> Load Tags File -> (load 'tags' file) Then, select any var/func-n you're tracking and: Search -> Find Definition (CTRL-D) will go to that file EX: ctags -R ~gilberto/linux.2.6.11/ OTHER TOOLS: cscope / cbrowser CALLTIPS: NEdit also has this feature: Select a function then: show calltips (CTRL=') It will show the args on a popup ------------ lsmod --> list all kernel modules (needs tcsh) cat /proc/modules = lsmod --> list of all modules /proc/version --> shows the versions of linux, kernel, gcc find . -name 'sched*' --> find files below current directory and down find . -follow -name '*tex' --> also follows symbolic links diff -rq ./ ~canturk/downloads/linux/ --> finds differences btw files, and nonexustent files recursing through the 2 directories ---WGET--- wget -E -k -K -p -r -l 3 http://www.cppreference.com/index.html --> gets the URL with up to 3 links to local wget -r -l1 --no-parent -A.gif http://host/dir/ --> You want to download all the GIFs from an HTTP directory wget -E -H -k -K -nh -p http://www.wmin.ac.uk/studentprofiles.asp --> TO COPY A WEB PAGE, ONLY THE SINGLE PAGE WITH ITS IMAGES, ETC. BUT NO LINKS ARE TRAVERSED!! XXX mount -t vfat /dev/sda1 win XXX (olmuyo) gdb --> gnu c debugger mplayer --> plays avi, i can use from nautlius, type mplayer for options shortcuts: canturk/.gnome-desktop> has desktop shortcup definitions i.e. nautilus.desktop making a tar ball: tar -zcvf SimpleSim-ARM_Benchmarks.tgz benchmarks/ IF YOU WANT TO READ STH THAT IS WRITTEN TO CONSOLE: you can read it from: /var/log/messages of that machine!! to get linux version: uname -r cd /lib/modules/`uname -r`/ --> replaces `uname -r` with the o/p of the command to set a new variable: set kjh=5 OR set kjh=`uname` /etc/passwd: contains information on the users of your system. If you edit it with a text editor, you will notice that it contains lines like this one: username:Igljf78DS:132:20:User's Name and info:/home/username:/bin/csh The sign (:) splits the line into seven segments. The segments follow the following scheme: username : password : UID : GID : comment : home directory : login command /etc/group: contains information about the group of the system. It's lines are like the bellow: group:*:15:user1,user2,user3 following the scheme: group name : password : GID : users of the group id: prints uid and username for current user How to Unzip .tar.bz2 files: bzip2 -cd file.tar.bz2 | tar xvf - *VNC: Run in windoze machine(i.e. edojyo): winvnc, define passwd Run in Linux: vncviever edojyo:0 --> type passwd F8 --> fullscreen mod'da filan popup menu cikariyo VNC2: Run in Linux Machine vncserver In windoz run vncviewer.exe machine name: esterhazy.ee.princeton.edu:1 passwd: passwd .vnc/xstartup --> put the programs to run at the beginning here (i.e. panel etc.) TO KILL: vncserver -kill :1 LAPTOP icin: vncserver -geometry 1300x975 at : su saatte sunu yap komutu echo "cmd" | at now + 2 hours at -l --> will list your scheduled jobs atq: list of pending jobs atrm: remove jobs cron : scheduling yapmaya yariyo nslookup: to look up an ip name wc -l --> count lines of file csplit --> split files sed -n 20,35p --> show lines 20-35 of a file (same as head -n 35 | tail -n 15) SCP: MOVING STUFF TO EE: scp AIX_HELP canturk@esterhazy.ee.princeton.edu:/home/canturk/IBM/ MOVING FROM EE: scp canturk@esterhazy.ee.princeton.edu:/home/canturk/Book1.tex ./ BAKUP PLATYPUS: cd /home scp -r canturk/ canturk@esterhazy.ee.princeton.edu:~/PLATYPUS_BAKMMDD/ SUBSAMPLING FILES: sed -n 'N;P' # every 2nd line, odd lines sed -n 'n;P' # even lines objdump -S binary > o/p file --> disasm redirect stderr in tcsh: (SpecTickerBatch > LOG) >& err_LOG timing of a prog: time NEDIT: keyboard shorcuts don't work ==> turn off scroll lock /etc/rc.d/init.d/lpd restart --> restart print deamon -- WHEN YOU HAVE A PROBLEM WITH MOUNTING A NETW FILE SYSTEM: (i.e. you ssh to karelian and it doesn't see your home = home_parapet) try: mount /home_parapet --> if it doesn't mount (times out) then there might be a problem with parapet. => Go to Parapet --> /etc/rc.d/init.d/nfs restart --> restart nfs deamon then try remounting stty -a: serial port info TO SET THE SERIAL PORT BAUD RATE: stty 9600 < /dev/ttyS0 TO MAKE SERIAL PORT READABLE BY USER: chmod 755 /dev/ttyS0 *umount & fam: eyer umount yapinca device busy diyosa --> fuser' la neyin cd yi kullandiini annarsin cd yi /mnt/cdrom/'dan umount yaparsan olmaz, 'fam' diye bi program calisiyo oluyo. 'device busy' deyo. cd to some othe directory, then umount. TO INSTALL STH TO A SPECIFIC DIRECTORY: - ADD the --prefix to configure script ./configure --prefix=/home/canturk/C/plotutils/ TO PLOT SOMETHING: graph -T X < ascii_data_file (See ascii_data_file format in C/ascii_data_file) (you can also make gif, png, ps, etc. with '-T gif' --> see gnu plotutils manual) MOUNTING/HOMES/FILESYSTEMS: ---------------------------------------------- ================================================================= TO MOUNT MY WINDOWS: dmesg --> bootlog dmesg | grep sda --> hard disk partitions (burdan denicez) sda: sda1 sda2 sda3 sda4 < sda5 > (sda5: linux), (sda1-sda4 windows olabilir) (OUR WIN2K is sda2) ROOT: mount /dev/sda2 /mnt/win -t ntfs --> mounts windows (read only) (If it complains "fs ntfs not supported by kernel" you need to-->) (/sbin/insmod /lib/modules/2.4.7-10/build/fs/ntfs/ntfs.o) < I can only access as root, but I cancopy to /tmp/ and chmod 755 there and then copy as canturk> I did this to access as canturk: "chown canturk:disk /dev/sda2" & I can mount but cannot access the folder as canturk:)) TO MOUNT MY USB: 1) see in "/proc/scsi/scsi" that the USB device is found: (cat /proc/scsi/scsi --> Host: scsi0 Channel: 00 Id: 00 Lun: 00 Vendor: FUJITSU Model: MAN3184MP Rev: 5507 Type: Direct-Access ANSI SCSI revision: 03 Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: LEXAR Model: JUMPDRIVE Rev: 1.20 Type: Direct-Access ANSI SCSI revision: 03 ) 2) Now find the device name for the USB: (I have a SCSI HDD as well, so my HDD is at sda1, and my USB will be at sdb1) 3) SU, then Make a USB mnt directory: "/mnt/usbhd" 4) (still root), then Add to /etc/fstab, the entry for the USB: "/dev/sdb1 /mnt/usbhd auto defaults 1 2" 5) NOW YOU CAN MOUNT IT AS: "mount /mnt/usbhd" 6) To be able to do this as canturk I did: "chown canturk:disk /dev/sdb1" & "chown canturk:canturk /mnt/usbhd" & Changed the fstab line as: /dev/sdb1 /mnt/usbhd auto defaults,owner 1 2" < NOW I CAN ACCESS AS CANTURK > MOUNTED STUFF INFO: /etc/fstab --> you can add here what you want to be mounted on boot MOUNT SHIT IN FSTAB IF YOU CHANGED IT: mount -av --> mnts everything in fstab TO SEE AVAILABLE DISK SPACE: df MKDIR ETC on DISK0: ssh to parapet su to root mkdir whatever chown canturk:canturk whatever MOVE OTHER PEOPLE'S ACCOUNTS: EX: skadron First -- create a folder as root on parapet. As root, chown and chgrp the folder to skadron. Second -- switch to skadron from root (you won't need a password) Third -- use whoami to make sure you are skadron. Then, copy (don't move) recursive and preserve-soft-links to the new directory. If you don't preserve the symbolic links it'll just copy the whole file and sometimes ruin the directory structure. I find it's easier to tar the directory and untar it in the new directory. This way you don't have to worry about chasing possibly recursive symlinks. But, in any case, please use cp and not mv. When you're sure all the files are moved across, then we can delete it or compress it or whatever, but just in case, use copy. - Philo > Hello again, sorry for the dumb mass mails. > > Is there a way we can chown or move the folders for say skadron? > when i try to mv it, all owners become nfsnobod in the new place, and i > cannot chown them back to skadron. (I do these as root). exportfs: export the NFS to hosts i.e. in parapet>exportfs exports to all hosts like esterhazy (/etc/rc.d/init.d/nfs restart) ---------------------------------------------------------------- ================================================================= TO COPY ONLY UPDATED/NONEXISTANT FILES: cp -uvr TO COPY .something files: cp ./.* LINUX BOOTING: look at my bookmark in linux for single user: init 1 for no x window: init 3 for x window: init 5 /etc/inittab: hangi runlevel'da hangi rc scriptlerin calistirildiginin yazdii file, hangi runlevel default o da var /sbin/chkconfig: hangi runlevel'da nelerin on/off olduunu listele ya da deistirmek icin script ptrace --> can do single step monitoring of a bench time at: echo "cmd" | at now + 2 hours at -l will list object dumping: objdump -S binary > o/p file splitting files: csplit nohup: no hangup: bununla calistirirsan bi programi, terminal windowu gapatsan bile program olmuyo nohup --> seklinde IMAGE CONVERSION/SCALING with convert: convert -geometry 75%x75% mic.png mic.eps Virtual memory monitors: vmstat free cat /proc/meminfo trap: used in sh/bash to trap specified interrupts. This you can have in your bash script. CTRL-C: is equal to kill -2 you can learn these by: trap 'echo "Oooowwww! Stop that. That hurts!"' 2 --> then when you press ctrl_C it says that if you simply type trap: You can learn the names of these signals (i.e. ctrl_C is SIGINT) To remove the trap: trap 2 --> will remove the trap on ctrl_C $! is the pid of the most recent process, $$ is the pid of the current process, $PPID is the parent pid. In Korn shell. To kill BG jobs, you can use job number: kill -2 %1 wait shell command: In a shell script, the wait command will wait for all background jobs to finish before proceeding. ---------- ... commandOne -a -x -b & commandTwo -vv file1 file2 & wait # waits for the two previous commands to finish ... ---------- adding the shared library stuff (i.e. ifort case): adding /opt/intel_fc_80/lib as a system shared library directory: - shared libraries are in /etc/ld.so.conf file --> this file shows the list of shared library directories - add /opt/intel_fc_80/lib here - then run: ldconfig --------------------- building ifort on another machine: --------------------------------- - go to: canturk/downloads/ifort/l_fc_pc_8.1.024> - su root - bash$ install.sh (by default installs everything in: /opt/intel_fc_80/ keep it this way so spec configs work) - do the above shared library update on that machine -DONE ----------------------------------- CONDOR ------- - compile the exec for condor (works mostly best from parapet) (i) condor_compile gcc ex.c -o ex (ii) condor_compile make (iii) make your makefile with condor compile as in /condor/BBV_PMC_PWR_AggloPhasesCondor_Makefile - write a condor scriptfile: ex: /condor/COMPLETE.condor - condor_submit - condor_status [-claimed] --> tells the machine <-> job info - condor_q --> tells jobs in queue (from the machine you submitted th jobs) - condor_rm --> removes the job --------------------------------