linux commands details

Upload: smruti2012

Post on 14-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Linux Commands Details

    1/5

    Area Command Description and/or Example

    daemons kill -9 PIDnumber

    Kills the process PIDnumber that we wantto (it stops running) kill -HUP PIDnumbedoes the same. Kill -STOP PIDnumber

    Stopis until a new command theNumberPID process. Kill -CONTPIDnumber Resumes the numberPID

    process that we stopped before.

    daemons killall processname Kills processname.

    daemons ps aux

    Lists the aplications that are now runningwith his PID(Process IDentifier). ps aux |more Pauses between screens. Very usefulto get information to kill a running

    process.

    daemons topShows the processes sorted by CPU use onreal time, also free RAM and used SWAP.

    daemons xkill

    Kills on X-windows the process that weselect by clicking it with the mouse. It's thesame as kill but on graphical mode.Hotkey: Ctrl+Alt+ESC

    files alias ls='ls --color=tty'

    When you type ls you'll see color outputbut only if the output goes to screen (not afile) you could insert this line in~/.bash_profile to always do it.

    files dd if=/dev/fd0 of=diskimagenameMakes a disk image and saves it ondiskimagename file.

    files dd if=diskimagename of=/dev/fd0Saves the diskimagename file to a floppydisk.

    files df Shows free disk space.

    files du -c files Shows the total size used by the files.

    files du -s directory Shows the directory size.

    files echo $PATH Shows the current path.

    files emacs filenameEdits the filename Ctrl+X Ctrl+S (save),Ctrl+X Ctrl+C (quit).

    files find /directory -name 'filename'Searches from directory the specifiedfilename.

    files for x in $(ls /directory) do echo $x doneA little bash script to loop on the files in adirectory.

    files grepSearches for a string on a file. cat file.txt |grep stringtolookfor

    files joe filename Text editor.

  • 7/29/2019 Linux Commands Details

    2/5

    files less ficheroI'ts like a better more, allows to go up anddown and doesn't load the all the entire filewhen you call it.

    files

    ln -s /mnt/cdrom/Mame/roms

    /usr/games/lib/xmame

    Makes a soft link to the cdrom roms

    directory as if it was /usr/games/lib/xmame(xmame must not exist)

    files mke2fs /dev/hda2Formats the second partition from the firsthard disk using the Linux format (ext2).

    files more filenameShows filename on screen (it's lik: type |more on ms-dos) .

    files mount /dev/hda1 /mnt/c -t vfat Mounts fat32 partition.

    files pico filenameA basic text editor. Needs It's size in bytesis very low.

    files rm -rf directoryDeletes the directory and all the fileswithin. No confirmation requiered.

    files sedChanges a string for another one on a file(used with pipes).

    filessed 's/stringA/StringB/' filename >newfilename

    Changes the first occurrence of stringA onfilename for stringB and saves it innewfilename.

    filessed 's/stringA/stringB/g' filename >newfilename

    Changes all the occurrence of stringA onfilename for stringB and saves it in

    newfilename.

    files tail -f filenameShows only the last lines of filename (goodto follow on real-time log files).

    files tar -zcvf filename.tar.gz directoryCompresses in tarball the directory and allsubdirectories into filename.tar.gz

    files tar -zxvf filename.tar.gz Decompress filename.tar.gz

    files wc filenameLine count, word cound and byte count forthe file.

    files whereis filenameFinds filename and says where it is usingthe internal data base, that must beupdated. updatedb updates it.

    files zip -r targetfilename directoryCompress directory and all its folders onficherodestino.zip

    fileszip -r zipfilenameyouwant.zipdesiredirectoryname

    Compresses using zip thedesiredirectoryname and all thesubdirectories.

    imageconvert -resize 640x480 original.jpgmodified.jpg

    Converts image to 640x480

    image mplayer videoyouwant.avi -vo aa Plays the video on ascii art.

  • 7/29/2019 Linux Commands Details

    3/5

    network /etc/network/interfaces Edit this file to change IP on Debian

    network ifconfigShows your IP also is used to configureyour network card.

    network ncftp An improved ftp client for console

    network netstat -lnp --ipIf you type it being root, will displaycurrent running daemons.

    network scp [email protected]:/boot/vmlinux .Copies the file vmlinux remote from thehost 192.168.201 via ssh to currentdirectory.

    network wget -c --passive-ftp ftp://filenameDownloads the file or continues thedownload using FTP passive mode.

    network wget -c http://filenameDownloads the requested filename orcontinues the download if the connection

    was lost.

    network wget -rl 4 http://domainnameDownloads the website and all files on ituntil level 4

    sound mpg123 -q /directory/*.mp3 &Plays in background from the shell the.mp3 music files allocated on the directory.

    system /sbin/hdparm -d 1 /dev/hdaSets using_dma bit to 1 to enable Ultra-DMA access to disk.

    system /sbin/hdparm -tT /dev/hdaPerforms a timing benchmark on devicereads.

    system /sbin/hdparm /dev/hda Shows hard disk configuration parameters.

    system bash sh Extension.

    system bc Is a text mode calculator.

    system chs C shell.

    system dpkg -i package.deb Installs package.deb (Debian).

    systemif [ -x /path/to/dnetc ]; then echo"Starting Distributed.net Client..."

    /path/to/dnetc -quiet fi

    The file /etc/rc.d/rc.local is likeautoexec.bat from ms-dos and we cand addthis lines on it. If it's not running, will start

    dnetc application.

    system ksh Korn shell, combines sh and csh.

    system lastShow list of last logged in users (reads/var/log/wtmp).

    system ltrace elfexecutableTraces an elf executable program (nicehacking tool)

    system nohup scriptname &Runs scriptname in background and keepsrunning even if you close the windowshell.

    system pdksh ksh Extension.

  • 7/29/2019 Linux Commands Details

    4/5

    system rpm -e rpmnameUninstalls rpm previous isntalled package(the rpmname must be obtained from rpm-qa and without .rpm).

    system rpm -qa |grep ftp List current installed ftp servers.

    system rpm -qpl package.rpm Shows what files are on the package.

    system rpm -Uvh package.rpmUpgrades an installed package with thenew one or installs it.

    system setterm -blank 0Turns off console blank screensaver (thatis On by default), you can put it on/etc/rc.local

    system sh Changes to bash shell (Unix standard).

    system shutdown -h now Shutdowns the computer. The same as halt

    system shutdown -r now Reboots the computer. The same as reboot.

    system strace -s 200 executableIntercepts system calls which are received

    by a process -s 200 is for string size 200(nice hacking tools)

    sytem rpm -qi rpmnameQuerys about version, completedescription and more info for the package.

    time at 7:00 cdplayd Sets the computer to play the cd at 7:00.

    time atq Lists the automatic programmed jobs.

    time atrm 8 Deletes automatic job number 8.

    time date Shows system date and time.

    time date -s "04/25/05" +"%D" Changes sytem date to April, 25th 2005 .

    time date -s "15:00:00" +"%T" Changes system time to 15:00.

    timeEdit this file to memorize a job:etc/crontab

    Ex: 00 00 20 10 * echo 'The winter is here'>/dev/null (this last command is to notsend a mail to root). On the nextdirectories you could copy applications orscripts that will run every time period./etc/cron.hourly/ /etc/cron.daily/

    /etc/cron.wee

    time rdate -p ntp.nasa.gov Shows the server date and time.

    time rdate -s ntp.nasa.govSynchronizes your time and date with theserver.

    time time applicationRuns the application and when it's finishedshows the running time.

    time uptimeShows the total time since the computerwas turned on.

    users /usr/bin/gpasswd -a user group Asign that user to that group.

  • 7/29/2019 Linux Commands Details

    5/5

    users chmod mode file Changes the file permissions

    users chown user:group file Changes the file user and group owner.

    users gpasswd -d user groupTo remove users from a group. The sameis to edit: /etc/group

    users groups username Shows groups that username is on

    users id usernameShows user identification and groupswhere he is on.

    users su You become root until type: exit.

    users su -Becomes root and reads root user'senvironment.

    users usermod -G group1,group2 user Asign groups to a user.

    X setxkbmap

    Try if your AltGr keys doesn't work on X

    mode.

    X switchdesk desktoptypeChanges the default desktop to anther(gnome, kde, wmaker, etc...).