+ Reply to Thread
Results 1 to 4 of 4




  

Thread: Some Basic Linux Commands, For Beginners...

      
  1. #1
    Jedi Master juanmorris is on a distinguished road juanmorris's Avatar
    Join Date
    March 3, 2010
    Posts
    17
    Rep Power
    3
    Feedback Score
    0

    Default Some Basic Linux Commands, For Beginners...

    Some Basic Linux Commands, For Beginners... An A-Z Index of the Linux BASH command line

    alias Create an alias
    awk Find and Replace text, database sort/validate/index
    break Exit from a loop
    builtin Run a shell builtin

    cal Display a calendar
    case Conditionally perform a command
    cat Display the contents of a file
    cd Change Directory
    cfdisk Partition table manipulator for Linux
    chgrp Change group ownership
    chmod Change access permissions
    chown Change file owner and group
    chroot Run a command with a different root directory
    cksum Print CRC checksum and byte counts
    clear Clear terminal screen
    cmp Compare two files
    comm Compare two sorted files line by line
    command Run a command - ignoring shell functions
    continue Resume the next iteration of a loop
    cp Copy one or more files to another location
    cron Daemon to execute scheduled commands
    crontab Schedule a command to run at a later time
    csplit Split a file into context-determined pieces
    cut Divide a file into several parts

    date Display or change the date & time
    dc Desk Calculator
    dd Data Dump - Convert and copy a file
    declare Declare variables and give them attributes
    df Display free disk space
    diff Display the differences between two files
    diff3 Show differences among three files
    dir Briefly list directory contents
    dircolors Colour setup for `ls'
    dirname Convert a full pathname to just a path
    dirs Display list of remembered directories
    du Estimate file space usage

    echo Display message on screen
    ed A line-oriented text editor (edlin)
    egrep Search file(s) for lines that match an extended expression
    eject Eject CD-ROM
    enable Enable and disable builtin shell commands
    env Display, set, or remove environment variables
    eval Evaluate several commands/arguments
    exec Execute a command
    exit Exit the shell
    expand Convert tabs to spaces
    export Set an environment variable
    expr Evaluate expressions

    factor Print prime factors
    false Do nothing, unsuccessfully
    fdformat Low-level format a floppy disk
    fdisk Partition table manipulator for Linux
    fgrep Search file(s) for lines that match a fixed string
    find Search for files that meet a desired criteria
    fmt Reformat paragraph text
    fold Wrap text to fit a specified width.
    for Expand words, and execute commands
    format Format disks or tapes
    free Display memory usage
    fsck File system consistency check and repair
    function Define Function Macros

    gawk Find and Replace text within file(s)
    getopts Parse positional parameters
    grep Search file(s) for lines that match a given pattern
    groups Print group names a user is in
    gzip Compress or decompress named file(s)

    hash Remember the full pathname of a name argument
    head Output the first part of file(s)
    history Command History
    hostname Print or set system name

    id Print user and group id's
    if Conditionally perform a command
    import Capture an X server screen and save the image to file
    info Help info
    install Copy files and set attributes

    join Join lines on a common field

    kill Stop a process from running

    less Display output one screen at a time
    let Perform arithmetic on shell variables
    ln Make links between files
    local Create variables
    locate Find files
    logname Print current login name
    logout Exit a login shell
    look Display lines beginning with a given string
    lpc Line printer control program
    lpr Off line print
    lprint Print a file
    lprintd Abort a print job
    lprintq List the print queue
    lprm Remove jobs from the print queue
    ls List information about file(s)

    m4 Macro processor
    man Help manual
    mkdir Create new folder(s)
    mkfifo Make FIFOs (named pipes)
    mknod Make block or character special files
    more Display output one screen at a time
    mount Mount a file system
    mtools Manipulate MS-DOS files
    mv Move or rename files or directories

    nice Set the priority of a command or job
    nl Number lines and write files
    nohup Run a command immune to hangups

    passwd Modify a user password
    paste Merge lines of files
    pathchk Check file name portability
    ping Test a network connection
    popd Restore the previous value of the current directory
    pr Prepare files for printing
    printcap Printer capability database
    printenv Print environment variables
    printf Format and print data
    ps Process status
    pushd Save and then change the current directory
    pwd Print Working Directory

    quota Display disk usage and limits
    quotacheck Scan a file system for disk usage
    quotactl Set disk quotas

    ram ram disk device
    rcp Copy files between two machines.
    read read a line from standard input
    readonly Mark variables/functions as readonly
    remsync Synchronize remote files via email
    return Exit a shell function
    rm Remove files
    rmdir Remove folder(s)
    rpm Remote Package Manager
    rsync Remote file copy (Synchronize file trees)

    screen Terminal window manager
    sdiff Merge two files interactively
    sed Stream Editor
    select Accept keyboard input
    seq Print numeric sequences
    set Manipulate shell variables and functions
    shift Shift positional parameters
    shopt Shell Options
    shutdown Shutdown or restart linux
    sleep Delay for a specified time
    sort Sort text files
    source Run commands from a file `.'
    split Split a file into fixed-size pieces
    su Substitute user identity
    sum Print a checksum for a file
    symlink Make a new name for a file
    sync Synchronize data on disk with memory

    tac Concatenate and write files in reverse
    tail Output the last part of files
    tar Tape ARchiver
    tee Redirect output to multiple files
    test Evaluate a conditional expression
    time Measure Program running time
    times User and system times
    touch Change file timestamps
    top List processes running on the system
    traceroute Trace Route to Host
    trap Run a command when a signal is set(bourne)
    tr Translate, squeeze, and/or delete characters
    true Do nothing, successfully
    tsort Topological sort
    tty Print filename of terminal on stdin
    type Describe a command

    ulimit Limit user resources
    umask Users file creation mask
    umount Unmount a device
    unalias Remove an alias
    uname Print system information
    unexpand Convert spaces to tabs
    uniq Uniquify files
    units Convert units from one scale to another
    unset Remove variable or function names
    unshar Unpack shell archive scripts
    until Execute commands (until error)
    useradd Create new user account
    usermod Modify user account
    users List users currently logged in
    uuencode Encode a binary file
    uudecode Decode a file created by uuencode

    v Verbosely list directory contents (`ls -l -b')
    vdir Verbosely list directory contents (`ls -l -b')
    vi Text Editor

    watch Execute/display a program periodically
    wc Print byte, word, and line counts
    whereis Report all known instances of a command
    which Locate a program file in the user's path.
    while Execute commands
    who Print all usernames currently logged in
    whoami Print the current user id and name (`id -un')

    xargs Execute utility, passing constructed argument list(s)
    yes Print a string until interrupted

    .period Run commands from a file
    ### Comment / Remark
    Last edited by juanmorris; Mar 3rd, 2010 at 12:54 am.

  2. #2
    Jedi Master juanmorris is on a distinguished road juanmorris's Avatar
    Join Date
    March 3, 2010
    Posts
    17
    Rep Power
    3
    Feedback Score
    0

    Default Re: Some Basic Linux Commands, For Beginners...

    This is a practical selection of the commands we use most often. Press <Tab> to see the listing of all available command (on your PATH). On my small home system, it says there are 2595 executables on my PATH. Many of these "commands" can be accessed from your favourite GUI front-end (probably KDE or Gnome) by clicking on the right menu or button. They can all be run from the command line. Programs that require GUI have to be run from a terminal opened under a GUI.
    Legend:
    <> = single special or function key on the keyboard. For example <Ctrl> indicates the "control" key.
    italic = name of the file or variable you probably want to substitute with your own.
    fixed width = in-line Linux commands and filenames.
    Notes for the UNIX Clueless:
    1. LINUX IS CASE-SENSITIVE. For example: Netscape, NETSCAPE and nEtscape are three different commands. Also my_filE, my_file, and my_FILE are three different files. Your user login name and password are also case sensitive. (This goes with the tradition of UNIX and the "c" programming language being case sensitive.)
    2. Filenames can be up to 256 characters long and can contain letters, numbers, "." (dot), "_" (underscore), "-" (dash), plus some other not recommended characters.
    3. Files with names starting with "." are normally not shown by the ls (list) or dir commands. Think of these files as "hidden". Use ls -a (list with the option "all") to see these files.
    4. "/" is an equivalent to DOS "\" (root directory, meaning the parent of all other directories).
    5. Under Linux, all directories appear under a single directory tree (there are no DOS-style drive letters).
    6. In a configuration file, a line starting with # is a comment.
    7.1 Linux essential shortcuts and sanity commands

    <Ctrl><Alt><F1>
    Switch to the first text terminal. Under Linux you can have several (6 in standard setup) terminals opened at the same time. <Ctrl><Alt><Fn> (n=1..6)
    Switch to the nth text terminal.
    tty
    Print the name of the terminal in which you are typing this command.
    <Ctrl><Alt><F7>
    Switch to the first GUI terminal (if X-windows is running on this terminal).
    <Ctrl><Alt><Fn> (n=7..12)
    Switch to the nth GUI terminal (if a GUI terminal is running on screen n-1). On default, nothing is running on terminals
    8 to 12, but you can run another server there.
    <Tab>
    (In a text terminal) Autocomplete the command if there is only one option, or else show all the available options.
    THIS SHORTCUT IS GREAT! It even works at LILO prompt!
    <ArrowUp>
    Scroll and edit the command history. Press <Enter> to execute.
    <Shift><PgUp>
    Scroll terminal output up. Work also at the login prompt, so you can scroll through your bootup messages.
    <Shift><PgDown>
    Scroll terminal output down.
    <Ctrl><Alt><+>
    (in X-windows) Change to the next X-server resolution (if you set up the X-server to more than one resolution). For multiple resolutions on my standard SVGA card/monitor, I have the following line in the file /etc/X11/XF86Config (the first resolution starts on default, the largest determines the size of the "virtual screen"):
    Modes "1024x768" "800x600" "640x480" "512x384" "480x300" "400x300" "1152x864"
    <Ctrl><Alt><->
    (in X-windows) Change to the previous X-server resolution.
    <Ctrl><Alt><BkSpc>
    (in X-windows) Kill the current X-windows server. Use if the X-windows server crushes and cannot be exited normally.
    <Ctrl><Alt><Del>
    Shut down the system and reboot. This is the normal shutdown command for a user at the text-mode console. Don't just press the "reset" button for shutdown!
    <Ctrl>c
    Kill the current process (mostly in the text mode for small applications).
    <Ctrl>d
    Log out from the current terminal. See also the next command.
    <Ctrl>d
    Send [End-of-File] to the current process. Don't press it twice else you also log out (see the previous command).
    <Ctrl>s
    Stop the transfer to the terminal.
    <Ctrl>q
    Resume the transfer to the terminal. Try if your terminal mysteriously stops responding.
    <Ctrl>z
    Send the current process to the background.
    exit
    Logout. I can also use logout for the same effect. (If you have started a second shell, e.g., using bash the second shell will be exited and you will be back in the first shell, not logged out.)
    reset
    Restore a screwed-up terminal (a terminal showing funny characters) to default setting. Use if you tried to "cat" a binary file. You may not be able to see the command as you type it.
    <MiddleMouseButton>
    Paste the text which is currently highlighted somewhere else. This is the normal "copy-paste" operation in Linux. (It doesn't work with Netscape and WordPerfect which use the MS Windows-style "copy-paste". It does work in the text terminal if you enabled "gpm" service using "setup".) Best used with a Linux-ready 3-button mouse (Logitech or similar) or else set "3-mouse button emulation").
    ~
    (tilde) My home directory (normally the directory /home/my_login_name). For example, the command cd ~/my_dir will change my working directory to the subdirectory "my_dir" under my home directory. Typing just "cd" alone is an equivalent of the command "cd ~".
    .
    (dot) Current directory. For example, ./my_program will attempt to execute the file "my_program" located in your current working directory.
    ..
    (two dots) Directory parent to the current one. For example, the command cd .. will change my current working directory one one level up.
    7.2 Common Linux commands--system info

    pwd
    Print working directory, i.e., display the name of my current directory on the screen. hostname
    Print the name of the local host (the machine on which you are working). Use netconf (as root) to change the name of the machine.
    whoami
    Print my login name.
    id username
    Print user id (uid) and his/her group id (gid), effective id (if different than the real id) and the supplementary groups.
    date
    Print or change the operating system date and time. E.g., I could change the date and time to 2000-12-31 23:57 using this command:
    date 123123572000
    To set the hardware (BIOS) clock from the system (Linux) clock, use the command (as root) setclock
    time
    Determine the amount of time that it takes for a process to complete + other info. Don't confuse it with the date command. E.g. I can find out how long it takes to display a directory content using:
    time ls
    who
    Determine the users logged on the machine.
    rwho -a
    (=remote who) Determine all users logged on your network. The rwho service must be enabled for this command to run. If it isn't, run setup as root to enable "rwho".
    finger user_name
    System info about a user. Try: finger root
    last
    Show listing of users last logged-in on your system.
    history | more
    Show the last (1000 or so) commands executed from the command line on the current account. The "| more" causes the display to stop after each screenful.
    uptime
    Show the amount of time since the last reboot.
    ps
    (=print status) List the processes currently run by the current user.
    ps axu | more
    List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.
    top
    Keep listing the currently running processes, sorted by cpu usage (top users first). In KDE, you can get GUI-based Ktop from "K"menu under "System"-"Task Manager" (or by executing "ktop" in an X-terminal).
    uname -a
    (= Unix name with option "all") Info on your (local) server. I can also use guname (in X-window terminal) to display the info more nicely.
    free
    Memory info (in kilobytes).
    df -h
    (=disk free) Print disk info about all the filesystems (in human-readable form)
    du / -bh | more
    (=disk usage) Print detailed disk usage for each subdirectory starting at the "/" (root) directory (in human legible form).
    cat /proc/cpuinfo
    Cpu info--it show the content of the file cpuinfo. Note that the files in the /proc directory are not real files--they are hooks to look at information available to the kernel.
    cat /proc/interrupts
    List the interrupts in use.
    cat /proc/version
    Linux version and other info
    cat /proc/filesystems
    Show the types of filesystems currently in use.
    cat /etc/printcap
    Show the setup of printers.
    lsmod
    (As root. Use /sbin/lsmod to execute this command when you are a non-root user.) Show the kernel modules currently loaded.
    set|more
    Show the current user environment.
    echo $PATH
    Show the content of the environment variable "PATH". This command can be used to show other environment variables as well. Use "set" to see the full environment.
    dmesg | less
    Print kernel messages (the content of the so-called kernel ring buffer). Press "q" to quit "less". Use less /var/log/dmesg to see what "dmesg" dumped into this file right after the last system bootup.

  3. #3
    Jedi Master juanmorris is on a distinguished road juanmorris's Avatar
    Join Date
    March 3, 2010
    Posts
    17
    Rep Power
    3
    Feedback Score
    0

    Default Re: Some Basic Linux Commands, For Beginners...

    7.3 Basic operations

    any_command --help |more
    Display a brief help on a command (works with most commands). "--help" works similar to DOS "/h" switch. The "more" pipe is needed if the output is longer than one screen. man topic
    Display the contents of the system manual pages (help) on the topic. Try man man first. Press "q" to quit the viewer. The command info topic works similar and may contain more up-to-date information. Manual pages can be hard to read. Try any_command --help for short, easy to digest help on a command. If more info needed, have a look to the directory /usr/doc. To display manual page from a specific section, I may use something like in this example: man 3 exit (this displays an info on the command exit from section 3 of the manual pages).
    apropos topic
    Give me the list of the commands that have something to to do with my topic.
    help command
    Display brief info on a bash (shell) build-in command.
    ls
    List the content of the current directory. Under Linux, the command "dir" is an alias to ls. Many users have "ls" to be an alias to "ls --color".
    ls -al |more
    List the content of the current directory, all files (also those starting with a dot), and in a long form. Pipe the output through the "more" command, so that the display pauses after each screenful.
    cd directory
    Change directory. Using "cd" without the directory name will take you to your home directory. "cd -" will take you to your previous directory and is a convenient way to toggle between two directories. "cd .." will take you one directory up.
    cp source destination
    Copy files. E.g., cp /home/stan/existing_file_name . will copy a file to my current working directory. Use the "-r" option (for recursive) to copy the contents of whole directories, e.g. , cp -r my_existing/dir/ ~ will copy a subdirectory under my current working directory to my home directory.
    mcopy source destination
    Copy a file from/to a DOS filesystem (no mounting necessary). E.g., mcopy a:\autoexec.bat ~/junk . See man mtools for related commands: mdir, mcd, mren, mmove, mdel, mmd, mrd, mformat ....
    mv source destination
    Move or rename files. The same command is used for moving and renaming files and directories.
    ln source destination
    Create a hard link called destination to the file called source. The link appears as a copy of the original files, but in reality only one copy of the file is kept, just two (or more) directory entries point to it. Any changes the file are automatically visible throughout. When one directory entry is removed, the other(s) stay(s) intact. The limitation of the hard links are: the files have to be on the same filesystem, hard links to directories or special files are impossible.
    ln -s source destination
    Create a symbolic (soft) link called "destination" to the file called "source". The symbolic link just specifies a path where to look for the file. In contradistinction to hard links, the source and destination don't not have to tbe on the same filesystem. In comparison to hard links, the drawback of symbolic links are: if the original file is removed, the link is "broken", symbolic links can also create circular references (like circular references in spreadsheets or databases, e.g., "a" points to "b" and "b" points back to "a").
    rm files
    Remove (delete) files. You must own the file in order to be able to remove it. On many systems, you will be asked or confirmation of deleation, if you don't want this, use the "-f" (=force) option, e.g., rm -f * will remove all files in my current working directory, no questions asked.
    mkdir directory
    Make a new directory.
    rmdir directory
    Remove an empty directory.
    rm -r files
    (recursive remove) Remove files, directories, and their subdirectories. Careful with this command as root--you can easily remove all files on the system with such a command executed on the top of your directory tree, and there is no undelete in Linux (yet). But if you really wanted to do it (reconsider), here is how (as root): rm -rf /*
    cat filename | more
    View the content of a text file called "filename", one page a time. The "|" is the "pipe" symbol (on many American keyboards it shares the key with "\") The pipe makes the output stop after each screenful. For long files, it is sometimes convenient to use the commands head and tail that display just the beginning and the end of the file. If you happened to use "cat" a binary file and your terminal displays funny characters afterwards, you can restore it with the command "reset".
    less filename
    Scroll through a content of a text file. Press q when done. "Less" is roughly equivalent to "more" , the command you know from DOS, although very often "less" is more convenient than "more".
    pico filename
    Edit a text file using the simple and standard text editor called pico.
    pico -w filename
    Edit a text file, while disabling the long line wrap. Handy for editing configuration files, e.g. /etc/fstab.
    find / -name "filename"
    Find the file called "filename" on your filesystem starting the search from the root directory "/". The "filename" may contain wildcards (*,?).
    locate filename
    Find the file name of which contains the string "filename". Easier and faster than the previous command but depends on a database that normally rebuilds at night.
    ./program_name
    Run an executable in the current directory, which is not on your PATH.
    touch filename
    Change the date/time stamp of the file filename to the current time. Create an empty file if the file does not exist.
    xinit
    Start a barebone X-windows server (without a windows manager).
    startx
    Start an X-windows server and the default windows manager. Works like typing "win" under DOS with Win3.1
    startx -- :1
    Start another X-windows session on the display 1 (the default is opened on display 0). You can have several GUI terminals running concurrently. Switch between them using <Ctrl><Alt><F7>, <Ctrl><Alt><F8>, etc.
    xterm
    (in X terminal) Run a simple X-windows terminal. Typing exit will close it. There are other, more advanced "virtual" terminals for X-windows. I like the popular ones: konsole and kvt (both come with kde) and gnome-terminal (comes with gnome). If you need something really fancy-looking, try Eterm.
    xboing
    (in X terminal). Very nice, old-fashioned game. Many small games/programs are probably installed on your system. I also like xboard (chess).
    shutdown -h now
    (as root) Shut down the system to a halt. Mostly used for a remote shutdown. Use <Ctrl><Alt><Del> for a shutdown at the console (which can be done by any user).
    halt
    reboot
    (as root, two commands) Halt or reboot the machine. Used for remote shutdown, simpler to type than the previous command.

  4. #4
    I'm New! danny0085 is on a distinguished road
    Join Date
    August 25, 2011
    Posts
    1
    Rep Power
    0
    Feedback Score
    0

    Default Re: Some Basic Linux Commands, For Beginners...

    Here you can check out the most used linux commands .

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. SEO for Beginners
    By Ohiosweetheart in forum SEO Forum
    Replies: 110
    Last Post: May 12th, 2011, 7:26 am
  2. Use of Copy and Paste Commands???
    By realistic in forum Computers and Electronics
    Replies: 5
    Last Post: Dec 15th, 2009, 11:51 pm
  3. Hosting for beginnerS?
    By unr in forum Web Hosting
    Replies: 22
    Last Post: Feb 12th, 2008, 6:54 am
  4. Linux commands you can use via SSH
    By Big Dan in forum Dedicated / VPS Hosting
    Replies: 11
    Last Post: Feb 3rd, 2008, 1:11 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
WebTalkForums
WebTalkForums
Recent Forum Threads