Monday, September 9, 2019

linux.random.basics.102.txt

linux.random.basics.102.txt
----
ifconfig eth0 192.168.1.12 netmask 255.255.255.0 broadcast 192.168.1.255
iwconfig wlan0 10.0.0.2 netmask 255.255.255.0 broadcast 10.0.1.255
netstat -s
----
# grep by IP
grep -r "127.0.0.1" /etc/ 
----
ps -A
ps -A | grep -i ssh 
----
# stop process by name
pkill apache2 
----
# create file system 
Mkfs.ext4 /dev/sda1 (sda1 block will be formatted)
mkfs.ext4 /dev/sdb1 (sdb1 block will be formatted)
----
# list open files
lsof----
# compare
cmp file1.txt file2.txt 
----
# steps to mount a drivelsblk cd /devmkdir usbmount /dev/sdb1 /dev/usb
----
# create file then compile w/ gcc
cat>>HellO.c<<"EOF"
#include <stdio.h>int main()
{  
printf("hellO world\n");  
return 0;
}
EOF

gcc HellO.c
./a.out
# or
gcc -o HellO HellO.c
/HellO
----
# create file then compile w/ g++
cat>>Add.cpp<<"EOF"
#include <iostream>using namespace std;int main()     
{          
int A;          
int B;          
cout <<"Enter 1st number:\n";          
cin >> A;          
cout <<"Enter 2nd number:\n";          
cin >> B;          
cin.ignore();          
int result = A + B;          
cout << "Result" <<"  "<<result<<endl;          
cin.get();          
return 0;     
}
EOF
Add.cpp
./a.out
# or
g++ -o Add Add.cpp
./Add
----
mysqldump -u root -p --all-databases > backupfile.sql

All menus I can find in one public spot