Saturday, April 7, 2012

Terminal Commands

System

  • uname -a            -- print system information
  • cat /etc/issue      -– current distribution and version
  • lsb_release -a      -– prints version information for the Linux release
  • date                -– shows the date
  • cal                 -– calculator 
  • fsck                -– File System Check

    Hardware

    • lshw                -- list hardware
    • lspci               -- list all PCI devices 
    • lspci | grep VGA    –- specific graphics card model 
    • hwinfo              -- short overview of all hardware & more detailed info 
    • lsusb               -- USB buses and attached devices

    Processor

    • cat /proc/cpuinfo   -– all processors, clock speeds, flags...
    • cat /proc/loadavg   –- processor load average for the last 1, 5, and 15 min 
    • top                 –- display Linux tasks 
    • uptime              –- current time elapsed since last reboot, users, and load average

      Memory

      • df -h               –- report file system disk space
      • du -sh <path>       –- estimate file space usage
      • cat /proc/meminfo   –- amount of RAM and swap, and how much is being used for what
      • free -m             –- total, used, and free memory shown in MB 
      • df -H               –- partitions, as well as their mount-points and usage in GB

        Drivers & Format

        • sudo fdisk -l       –- all partitions, their device names, and positions on disk

         
        * mount - Mount a Drive
        * umount - Unmount Drive
        * fdisk - Format Disk
        * dd - Dupliate Disk
        * df - Disk Free Space

        Networking

        • ifconfig            –- configure a network interface
        • iwconfig            –- configure a wireless network interface
        • ip addr             –- show / manipulate routing, devices, policy routing and tunnels
        • w                   –- output all currently logged in users and what they’re doing
        chkconfig - Check Activated Services
        * ping - Test Network Connections
        * ftp - file Transfer Protocol
        * host - Check IP of Domain
        * ifconfig - Configure Network Devices
        * netstat - Display Routing Table
        * route - Set Routes
        * telnet - Connect to telnet
        * traceroute - Display Route

        Packages

        • apt-get install/remove          –- install or remove a package
        • aptitude search <packagename>   –-search for a package similar to packagename
        • apt-cache showpkg <packagename> –- packagename’s version and dependencies


            Managing files

            • cp <file> <dest>    –- Copy
            • ls                  –- List
            • mkdir <foldername>  –- Make Directory 
            • mv                  –- Move
            • rm                  –- Remove
            • grep                –- Search for Text Strings
            • head                –- Display Start of File
            • less                –- Display Part of File
            • more                –- Display Part of File
            • tail                –- View the End of a File


            Users

            •  chgroup            –- change a user group

              chmod - Change Mode
              * su - Switch User

            passwd - Create Password
            * groupadd - Add a Group
            * groupmod - Modify a Group
            * chgrp - Change Group
            * groupdel - Delete Group
             

            Other

            • awk                 –- pattern scanning and processing language
            • alias               –- declare symbolic aliases for perl data
            • lshal -m            –- monitor for hardware changes

            Tips

            • sudo lshw -html > your-file-name.html
            • man everything :)

            file - typechecking of one or more ps - the ultimate system monitor for command line - also good for scripts
            * cat - print out a file in the command line

                No comments:

                Post a Comment