ls -ld
ls -sh list and size
Remote ssh -X IP
Search: find / -name ***
This will search the whole system for any files named foo and display their pathnames.
save command history to ***: history -w ***/history.txt
Clear terminal history: history -c
Quit terminal command: ctrl+c, the standard interrupt keypress
Add auto run to start list: /etc/fstab /usr/home/ changeip.dl default 0 0
--------------------------------------------------
rmdir /tmp/docs
rm -rf directory
Rename: mv test.txt hope.txt
Disk usage:
df -BG
du -sh direction1 output 500M direction1
du -h | tail -n 1 whole disk usage
Fix wrong name: mv E062607R\ / E062607R
ls -la ( ls l list files and permition )
last | more see user status in 1 month
--------------------------------------------------
Set the direction's owner: chown -R username somedir
Change file permition:
rwx = 111 in binary = 7 rw- = 110 in binary = 6
r-x = 101 in binary = 5 r-- = 100 in binary = 4
chmod 600 some_file
---------------------------------------------------
View a file
cat
tail
head
pg
Note: The commands listed below are also all capable of viewing a file.
Open, create, and edit a file
pico
vi
ued
ed
vim
vi //edit
i // insert
ESC
:w // write
:w! // force write
:quit
Ctrl+D // logout
----------------------------------------------------
VMware mount shared folders: /mnt/hgfs
sudo vmware-config-tools.pl to enable
---------------------------------------------------------------------
Mac Show Hidden Files:
killall Finder
-----------------------------------------------------------------------
List running program and kill it:
PS -A
killall -9 name(or number)
List and save as a file.txt
ls -d * > list.txt
ls -d */*
--------------------------------------------------------------------
Remote PV
ssh -X [email protected]
password
cd /opt/PV4.0
./pv
--------------------------------------------------------------------
Check size
df -H
Direction size
du -sH
Check ram(memory)
cat /proc/meminfo
Change Mac address
Check by: ethtool
Change:
ifconfig eth0 down
ifconfig eth0 hw ether 00:80:48:BA:d1:30
ifconfig eth0 up
ifconfig eth0 |grep HWaddr
Chceck IP wothout root
$ PATH=$PATH:/sbin ifconfig
---------------------------------------------------------------
files Transfer
ftp(sftp) 10.16.58.46
put 1.exe(local file)
download from ftp
get 1.txt
mutiple files use mput * or mget *
bye or exit
---------------------------------------------------------------
Clear Memory see Linux_Schedule
At the shell prompt type crontab -e as this will allow you to edit cron jobs for the root user.
press "i" to insert text and once done hit "esc" and type ":wq" to save the file.
Scroll to the bottom of the cron file using the arrows key and enter the following line:
1 * * * * /root/clearcache.sh
Create a file in '/root' called 'clearcache.sh' with the following content:
#!/bin/sh
sync; echo 3 > /proc/sys/vm/drop_caches
service crond stop
crond restart
hda2disk full
delete files in /var/log/audit.d
--------------------------------------------------------------
fix clonezilla recover doesn't boot up"
sudo mount /dev/sda5 /mnt && sudo mount -o bind /dev /mnt/dev && sudo mount -o bind /dev/pts /mnt/dev/pts && sudo mount -o bind /proc /mnt/proc && sudo mount -o bind /sys /mnt/sys && sudo chroot /mnt
grub-install /dev/sda
update-grub
exit
sudo umount /mnt/dev/pts && sudo umount /mnt/dev && sudo umount /mnt/proc && sudo umount /mnt/sys && sudo umount /mnt
sudo reboot
-------------------------------------------------------------
Lilo:
1.Boot from Linux installation CD and enter rescue mode;
boot: linux rescue
2.Mount all partitions and change root from the temporary root to the root partition of the installed system:
1).#mkdir /mnt/tmp
2).#mount /dev/sdXY /mnt/tmp (/dev/sdXY is the root partition sda1 oo rother)
3).#chroot /mnt/tmp
3. Run the following command to reactivate LILO:
#/sbin/lilo
4.Reboot.
-----------------------------------------------------------
cat >upload.sh
#!/bin/bash
HOST='140.113.196.5'
USER='****'
PASS='****'
TARGETFOLDER='/temp'
SOURCEFOLDER='/***/temp'
lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --reverse --delete --verbose $SOURCEFOLDER $TARGETFOLDER
bye
"
crontab -e
insert:
0 */1 * * * /root/Documents/upload.sh
Esc
:
wq!/ (or x x!)
----------------------
uninstall:
rpm -qa | grep teamviewer
rpm -e
-----------------------
block IP
firewall-cmd --permanent --add-rich-rule="rule family='ipv4' source address='180.76.15.0/24' reject"
firewall-cmd --reload
------
block all but a few ips with firewalld
firewall-cmd --zone=internal --add-service=ssh
firewall-cmd --zone=internal --add-source=162.129.*.*
firewall-cmd --zone=public --remove-service=ssh
------------------------
login as root using SSH:
Login, and edit this file: sudo nano /etc/ssh/sshd_config
Find this line: PermitRootLogin without-password
Edit: PermitRootLogin yes
Close and save file
reboot or restart sshd service using: /etc/init.d/ssh restart
Set a root password if there isn't one already: sudo passwd root