Sie sind auf Seite 1von 6

BASH HOTKEYS Bash provides many hot keys to ease use.

Like ctrl-l -- clear screen ctrl-r -- does a search in the previously given commands so that you don't have to repeat long command. ctrl-u -- clears the typing before the hotkey. ctrl-a -- takes you to the begining of the command you are currently typing. ctrl-e -- takes you to the end of the command you are currently typing in. esc-b -- takes you back by one word while typing a command. ctrl-c -- kills the current command or process. ctrl-d -- kills the shell. ctrl-h -- deletes one letter at a time from the command you are typing in. ctrl-z -- puts the currently running process in background, the process can be brought back to run state by using fg command. esc-p -- like ctrl-r lets you search through the previously given commands. esc-. -- gives the last command you typed. to check open ports nmap -v -P0 -sS 203.88.146.67 -p 3000,6666,22 to Man Network Drive 1) check /etc/exports file for configuration 2) start nfs service on local server and remote server using su -l root service nfs start 3) Mount the network drive to local folder with root privilege. mount <IP>:<N/W Folder <Local Folder> ########################################## To see if your system is short of physical memory, you can use /proc/meminfo and vmstat: # ps aux --sort pmem Then use 'ps ev --pid=<PID>' to show the change over time (you had to manually r epeat it or put it as a cron to a file): ps ev --pid=27645 ############## for memory mapping and details pmap <pid> ################memory usage for a process###### pmap -x <pid> ##########################find out IP details###### arp -a or -e #//give details of hostname and MAC address nbtstat -a ping -a nslookup

################RPM COmmands############## #to check for rpms Otherwise check using: rpm -qva | grep -i hpasm #to update rpm -Uvh <rpm name> #to install rpm -ivh <rpmname> #to update rpm -Uvh <rpm name) #to remove rpm -e

#############Delete file of size zero################### // description of your code here This will delete all files in the current directory with size == 0. 1 2 find . -type f -size 0k -exec rm {} \; | awk '{ print $8 }' #############Delete file of size zero################### #/bin/bash dir_to_clean=$1 cd $1 ls -1s |awk '{if ($1==0) print ("rm -f "$2)}' > rmscript chmod +x rmscript echo "The following files with zero size will be removed:" cat rmscript echo -n "Proceed? [Y/N]: " read response if [ "$response" == "Y" ]; then rmscript fi rm -rf rmscript ############################ Find out file inode First find out file inode number with any one of the following command: stat {file-name} OR ls -il {file-name} ############################### find . -inum [inode-number] -exec rm -i {} \;

eg. $ find . -inum 782263 -exec rm -i {} \; ##############tcp dump linux############### tcpdump -w tcmp4000dump2 -X port 4000 tcpdump dst host 192.168.0.123 and dst port 3000 -X ************************* Windows Hot Keys sfc /scannow : verifies windows file msconfig.exe : can change setting for services and startup #################### key form q 9198028 #################list all the created users############## cat /etc/passwd | cut -d ":" -f1 ################################# Find file owned by user id 1050 (useful if you deleted user account): # find / -uid 1050 Find out all files that are not owned by any user: # find / -nouser Find out all files that are not owned by any group: # find / -nogroup For example in real life on busy clustered hosting server some time we remove 510 users and for security reasons you need to find out all files are not owned b y any user or group then you can type command: # find / -nogroup -nouser ############################################################### I've been looking for file where is written who were logged to the system. Im us ing solaris 9. I tryed /var/log/syslog and /var/log/authlog. None of those file contain info about users who were logged. Any one has idea? Maybe i should start some proccess to logg this info ? last -100 ######################################################### ###############IMP Linux Command strace - trace system calls and signals SYNOPSIS strace [ -dffhiqrtttTvxx ] [ -acolumn ] [ -eexpr ] ... [ -ofile ] [ -ppid ] ... [ -sstrsize ] [ -uusername ] [ -Evar=val ] ... [ -Evar ] ... [ command [ arg ... ] ] strace -c [ -eexpr ] ... [ -Ooverhead ] [ -Ssortby ] [ command [ arg ... ] ] DESCRIPTION In the simplest case strace runs the specified command until it exits.

It intercepts and records the system calls which are called by a process and the signals which are received by a process. The name of each system call, its arguments and its return value are printed on standard error or to the file specified with the -o option. ******************** fdisk - Partition table manipulator for Linux SYNOPSIS sfdisk [options] device sfdisk -s [partition] DESCRIPTION sfdisk has four (main) uses: list the size of a partition, list the partitions on a device, check the partitions on a device, and - very dangerous - repartition a device. List Sizes sfdisk -s partition gives the size of partition in blocks. This may be useful in connection with programs like mkswap or so. Here partition is usually something like /dev/hda1 or /dev/sdb12, but may also be an entire disk, like /dev/xda. % sfdisk -s /dev/hda9 81599 % ************************* NAME newgrp - log in to a new group SYNOPSIS newgrp [ group ] DESCRIPTION Newgrp changes the group identification of its caller, analogously to login(1). The same person remains logged in, and the current directory is unchanged, but calculations of access permissions to files are performed with respect to the new group ID. If no group is specified, the GID is changed to the login GID. ************************* NAME shred - delete a file securely, first overwriting it to hide its contents SYNOPSIS shred [OPTIONS] FILE [...] DESCRIPTION Overwrite the specified FILE(s) repeatedly, in order to make it harder for even very expensive hardware probing to recover the data. Mandatory arguments to long options are mandatory for short options too. -f, --force change permissions to allow writing if necessary -n, --iterations=N

Overwrite N times instead of the default (25) -s, --size=N shred this many bytes (suffixes like K, M, G accepted) -u, --remove truncate and remove file after overwriting -v, --verbose show progress -x, --exact do not round file sizes up to the next full block ******************** NAME skill, snice - report process status SYNOPSIS skill [signal to send] [options] process selection criteria snice [new priority] [options] process selection criteria DESCRIPTION The default signal for skill is TERM. Use -l or -L to list available signals. Particularly useful signals include HUP, INT, KILL, STOP, CONT, and 0. Alternate signals may be specified in three ways: -9 -SIGKILL -KILL. The default priority for snice is +4. (snice +4 ...) Priority numbers range from +20 (slowest) to -20 (fastest). Negative priority numbers are restricted to administrative users. GENERAL OPTIONS -f fast mode -i interactive use -v -w -n verbose output warnings enabled no action This is not currently useful. You will be asked to approve each action. Display information about selected processes. This is not currently useful. This only displays the process ID. The options

PROCESS SELECTION OPTIONS Selection criteria can be: terminal, user, pid, command. below may be used to ensure correct interpretation. -t -u -p SIGNALS The next argument is a terminal (tty or pty). The next argument is a username. The next argument is a process ID number. -c The next argument is a command name.

The signals listed below are available for use with skill. When known, numbers and default behavior are shown. Name () () ALRM HUP 14 1 exit exit Num Action Description

INT KILL PIPE POLL PROF TERM USR1 USR2 VTALRM STKFLT UNUSED TSTP TTIN TTOU STOP CONT PWR WINCH CHLD URG ABRT FPE ILL QUIT SEGV TRAP SYS EMT BUS XCPU XFSZ

2 9 13 15

exit exit exit exit exit exit exit exit exit exit exit stop stop stop stop restart ignore ignore ignore core core core core core core core core core core core

this signal may not be blocked

i386, m68k, arm and ppc hardware only i386, m68k, arm and ppc hardware only context-dependent behavior may appear random context-dependent behavior may appear random context-dependent behavior may appear random this signal may not be blocked continue if stopped, otherwise ignore may exit on some systems ignore

6 8 4 3 11 5

may not be implemented may not be implemented core dump may fail core dump may fail core dump may fail Description Slow down netscape and crack Kill users on new-style PTY devices Stop 3 users Give priority to roots shell

EXAMPLES Command snice netscape crack +7 skill -KILL -v pts/* skill -STOP torvalds davem tytso snice -17 root bash ******************** SEE ALSO sln, ln(1) ldconfig(8) ld.so(8) ****************** mmap

Das könnte Ihnen auch gefallen