Linux Notes
- in Pine, to scroll to the top: w, then C-y
- in Pine, to scroll to the end: w, then C-v
- Pine's Pico Quick Refs
- to send standard output to the screen and a file simultaneously:
cmd | tee file
- to find files modified for the last 2 days: find . -mtime -2
- to only list hidden/files directories: ls -d .*
- use find with grep to find files that contain a word:
$ find ~ -name '*' -exec grep -l 'mystring' \{\} \;
- chmod octal numeric codes:
- 700: only owner can read
- 755: everyone can read but not write
- 775: only group can read and write
- 770: noone but group can read
- 666: everyone can read and write
- 1777: everyone can read,write,execute
- secure copy with ssh:
- to preserve time stamp : -p
- to scp to sdome: % scp filename userid@sdome:dir_name
- to scp from sdome % scp myid@sdome:dir/file file
- to cp preserving rights: cp -p
- to compare files with ssh:
ssh me@my.local.host cat myremote.file | diff - mylocal.file
- to get the number of lines in a file: wc -l myfile
- to create a new archive and copy file1 and file2 into it:
tar -cvf archive.tar dir_of_file1_and_2
- to untar: tar -vxf archive.tar
- to list file in archive.tar: tar -tvf archive.tar
- tar option keys:
c = create new
t = list the file names in archive
v = verbose mode
x = extract
u = add - to extract a file filename in a tar file filearch.tar:
tar -xvf filearch.tar `tar -tf filearch.tar |grep
filename` - to see a file type : file <filename>
- to only list directories:
ls -1F | grep / | sed 's/\///' | pr -t -4
- to only list files:
ls -1F | grep -v / | pr -t -3
- to check what's inside a ahared lib: nm mylib.so