Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4

Thread: Common Unix/Linux Commands used via Telnet

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Standard RSP member
    Join Date
    13 Feb 2007
    Location
    Earth
    Posts
    1,977
    Mentioned
    0 Post(s)
    Rep Power
    84

    Post Common Unix/Linux Commands used via Telnet

    Common Unix/Linux Commands used via Telnet


    cd
    When typed by itself, cd (”change directory”), will take you back to your $HOME directory

    cd /path/to/directory
    To change to a specific directory, type cd followed by the path to the directory. If it is a subdirectory of the current directory, you can just type the directory name.

    cd ..
    Typing cd .. moves you up one directory from your current location.

    pwd
    To see which directory you are in, type pwd (”print (display) working directory”).

    exit
    Just as it sounds, use exit to log out. Alternatively, you can type logout.

    Creating and Deleting Directories

    mkdir directoryname
    To create a new directory, type mkdir (”make directory”) and specify the new directory’s name.

    rmdir directoryname
    To delete an empty directory, type rmdir (”remove directory”) and the directory’s name.

    Listing Files

    ls
    To display a list of files and subdirectories in your current directory, type ls (”list”)

    ls -a
    To see a more complete list which includes hidden files or files that begin with a “.” (dot), type ls -a.

    ls -la
    To list all files and directories in long format which will provide details about each file and directory, type ls -la.

    ls -lS
    To list all directories and files, sorted by size, in long format, type ls -lS.

    ls -lta
    To list all files and directories in long format by time modified, type ls -lta.


    Copying Files

    cp oldfilename newfilename
    Will copy the contents of one file to another file, resulting in two copies of the same file on your account.

    cp directory/* destinationdirectory
    Will copy the contents of one directory to another directory. Make sure you have created the destination directory before trying to copy files to it - see mkdir above. Results in two copies of the files on your account; one copy in the existing directory and another in the destination directory.

    Searching FIles and Directories

    find -name ‘n*’
    The find command can be used to locate files or a group of files. It can also be used to display directories. The example given will find all file and directory names within the current directory and subdirectories of it that begin with the letter n. (You can also explore using the locate command - type info locate and/or man locate for usage information.)

    grep -inw text filename
    Can be used to locate text in a specific file or directory of files (use * in place of filename to search all of the files in the current directory). The -i argument indicates the search is to disregard cASe, the -n instructs to show the corresponding line number, and -w tells it to match only based on the whole word. (This doesn’t even begin to touch on the power of grep and its many uses. In addition to its searching capability, the grep command can be used in combination with other commands to act as a filter. It also allows the use of “wildcards”. Two other variations of grep are also available, egrep and fgrep. To begin your quest for more information, type man grep and/or info grep.)

    Displaying / Comparing File Content

    wc filename
    Counts and displays the number of lines, number of words, and number of characters of the given file.

    cat filename
    Displays the entire contents of a file.

    nl filename
    Shows the content of the file, including line numbers (nl=number lines).

    more filename
    Displays the contents of a file one screen at a time. Press the SPACEBAR to display the next screen of text.

    cmp filename1 filename2
    Compares the contents of the two named files and reports the first different character found and the line number.

    diff filename1 filename2
    Compares the contents of the two named files and reports all of the differences found. (Can also be used for comparing the contents of two directories.)

    Moving, Renaming, and Deleting Files

    mv oldfilename newfilename
    Can be used to rename a file (mv fileA fileB), move a file (mv fileA /dirA/), or both (mv fileA /dirB/fileB).

    rm -i filename
    Removes (deletes) the specified file. (The -i is not necessary, but is recommended as it will prompt you to confirm the action first. When prompted, type y to confirm or type n if you changed your mind.)

    Changing Permissions

    chmod permissions filename
    Changes the permissions on a filename or directory as specified. For example, chmod 755 startup.sh.

    Archives and Compression

    tar -cfv filename.tar directoryname
    To archive a directory and all of its contents including subdirectories, navigate to where the directory is located and type the above command, replacing filename.tar with the name you wish to give the archive file and directoryname with the name of the directory you wish to archive. Alternatively, you can archive a select group of individual files (or directories) by specifying each file name in place of directoryname separated by spaces, like tar -cvf filename.tar fileA fileB fileC. Note: When creating a tar file (aka “tarball”) be sure to specify the name you wish to give the tar file! (TAR indicates Tape ARchive, as it was originally a tape archiving program. The -c means “create”, v means “verbose” (which basically says tell me what you’re doing), and the f indicates that a filename will follow (filename.tar)).

    tar -tvf filename.tar
    Typing this command will result in a list of the contents of the tar file. This is generally a good thing to do before unpacking the tar file to be sure there are no matching filenames which will result in files being unintentionally overwritten.

    tar -xvf filename.tar
    You can see the similarities to the command used to tar the file. This time, though, you use -x to “extract” instead of the -c used to create. You can also extract only certain select files (or directories) by specifying the individual names, separated by spaces, after the tar filename, such as tar -xvf filename.tar fileA fileC

    gzip filename.tar
    This utility, gzip (gnu zip), is used for compression. Normally, when you wish to compress a set of files, you willtar them first then compress them using this command. In doing so, the filename will automatically change from filename.tar to filename.tar.gz (appending .gz to the file extension).

    gunzip filename.tar.gz
    This command (g”unzip”) is used to uncompress a .tar.gz file, which will also result in the filename being changed back to filename.tar. Once it has been uncompressed, you can then untar it using the tar command above. (Alternatively, you can use gzip -d (for “decompress”) in place of gunzip.)

    tar -czvf filename.tgz directoryname
    This command, which uses a z switch (”zip”), allows you to take a bit of a shortcut instead of using the tar and gzip commands separately. The example will result in a compressed archive named filename.tgz.

    tar -xzvf filename.tgz
    This command is used to uncompress and extract the files from a .tgz archive.
    Last edited by me1960; 03-03-09 at 11:33.
    Don't dream your life - live your DREAMbox ! DON'T FORGET TO SAY '' THANKS '' Note: Viewing Pay TV without a valid subscription is illegal All the files available here are kept for experimental and educational purpose only!

  2. #2
    Standard RSP member
    Join Date
    13 Feb 2007
    Location
    Earth
    Posts
    1,977
    Mentioned
    0 Post(s)
    Rep Power
    84

    Post Re: Common Unix/Linux Commands used via Telnet

    An A-Z Index of the Bash command line for Linux.

    alias Create an alias
    apropos Search Help manual pages (man -k)
    apt-get Search for and install software packages (Debian)
    aspell Spell Checker
    awk Find and Replace text, database sort/validate/index
    b
    bash GNU Bourne-Again SHell
    bc Arbitrary precision calculator language
    bg Send to background
    break Exit from a loop
    builtin Run a shell builtin
    bzip2 Compress or decompress named file(s)
    c
    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
    chkconfig System services (runlevel)
    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
    d
    date Display or change the date & time
    dc Desk Calculator
    dd Convert and copy a file, write disk headers, boot records
    ddrescue Data recovery tool
    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
    dig DNS lookup
    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
    dmesg Print kernel & driver messages
    du Estimate file space usage
    e
    echo Display message on screen
    egrep Search file(s) for lines that match an extended expression
    eject Eject removable media
    enable Enable and disable builtin shell commands
    env Environment variables
    ethtool Ethernet card settings
    eval Evaluate several commands/arguments
    exec Execute a command
    exit Exit the shell
    expect Automate arbitrary applications accessed over a terminal
    expand Convert tabs to spaces
    export Set an environment variable
    expr Evaluate expressions
    f
    false Do nothing, unsuccessfully
    fdformat Low-level format a floppy disk
    fdisk Partition table manipulator for Linux
    fg Send job to foreground
    fgrep Search file(s) for lines that match a fixed string
    file Determine file type
    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
    ftp File Transfer Protocol
    function Define Function Macros
    fuser Identify/kill the process that is accessing a file
    g
    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)
    h
    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
    i
    id Print user and group id's
    if Conditionally perform a command
    ifconfig Configure a network interface
    ifdown Stop a network interface
    ifup Start a network interface up
    import Capture an X server screen and save the image to file
    install Copy files and set attributes
    j
    join Join lines on a common field
    k
    kill Stop a process from running
    killall Kill processes by name
    l
    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)
    lsof List open files
    m
    make Recompile a group of programs
    man Help manual
    mkdir Create new folder(s)
    mkfifo Make FIFOs (named pipes)
    mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem
    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
    mmv Mass Move and rename (files)
    n
    netstat Networking information
    nice Set the priority of a command or job
    nl Number lines and write files
    nohup Run a command immune to hangups
    nslookup Query Internet name servers interactively
    o
    open Open a file in its default application
    op Operator access
    p
    passwd Modify a user password
    paste Merge lines of files
    pathchk Check file name portability
    ping Test a network connection
    pkill Stop processes from running
    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
    q
    quota Display disk usage and limits
    quotacheck Scan a file system for disk usage
    quotactl Set disk quotas
    r
    ram ram disk device
    rcp Copy files between two machines
    read read a line from standard input
    readonly Mark variables/functions as readonly
    reboot Reboot the system
    renice Alter priority of running processes
    remsync Synchronize remote files via email
    return Exit a shell function
    rev Reverse lines of a file
    rm Remove files
    rmdir Remove folder(s)
    rsync Remote file copy (Synchronize file trees)
    s
    screen Multiplex terminal, run remote shells via ssh
    scp Secure copy (remote file copy)
    sdiff Merge two files interactively
    sed Stream Editor
    select Accept keyboard input
    seq Print numeric sequences
    set Manipulate shell variables and functions
    sftp Secure File Transfer Program
    shift Shift positional parameters
    shopt Shell Options
    shutdown Shutdown or restart linux
    sleep Delay for a specified time
    slocate Find files
    sort Sort text files
    source Run commands from a file `.'
    split Split a file into fixed-size pieces
    ssh Secure Shell client (remote login program)
    strace Trace system calls and signals
    su Substitute user identity
    sudo Execute a command as another user
    sum Print a checksum for a file
    symlink Make a new name for a file
    sync Synchronize data on disk with memory
    t
    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
    u
    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
    v Verbosely list directory contents (`ls -l -b')
    vdir Verbosely list directory contents (`ls -l -b')
    vi Text Editor
    vmstat Report virtual memory statistics
    w
    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')
    Wget Retrieve web pages or files via HTTP, HTTPS or FTP
    write Send a message to another user
    x
    xargs Execute utility, passing constructed argument list(s)
    yes Print a string until interrupted
    . Run a command script in the current shell
    ### Comment / Remark
    Don't dream your life - live your DREAMbox ! DON'T FORGET TO SAY '' THANKS '' Note: Viewing Pay TV without a valid subscription is illegal All the files available here are kept for experimental and educational purpose only!

  3. #3
    Standard RSP member
    Join Date
    13 Feb 2007
    Location
    Earth
    Posts
    1,977
    Mentioned
    0 Post(s)
    Rep Power
    84

    Post Re: Common Unix/Linux Commands used via Telnet

    Useful Telnet and CLI commands for Dm and Linux servers

    When you Telnet your box or make a SSH connection shell to your Linux server, these commands are useful for you:
    1-Show me who is online, which IP and which Gbox Version is running:
    cat /var/tmp/share.onl

    2- Show me all Distance 1 cards:
    grep "dist:1" /var/tmp/share.info

    3- Show me all Distance 1 cards and resolve the Provider ID:
    for i in `grep 'dist:1' /var/tmp/share.info | awk '{print $6}' | sort` ; do grep "^$i" /var/keys/ident.info ; done

    4-remove the Windows carriage returns ^M on Textfiles:
    tr -s "\r" "\n" < winfile > unixfile

    5-Showing the ident.info file in a nice way:
    first CD to /var/keys
    then:
    cat ident.info | cut -c 1-9,19-196 > ident.info.new

    and you will see the providers lije this example:
    01000000;S0 - Mediaguard CAID
    01000002;(Old)S1 - Orbit (1W/26E)
    01000003;(Old)S1 - Canal+ France (19E)

    6-With this command, you can also see if gbox process is running:
    ps -ef

    7- To start cs2gbox:
    cd /var/bin/
    ./cs2gbox &

    8- To start gbox:
    cd /var/bin/
    ./gbox&

    9- To start cs2gbox and gbox together in Gemini:
    /var/script/gbox_cam.sh start

    10-To stop cs2gbox:
    killall cs2gbox

    11- To stop gbox:
    killall gbox

    12- To chmod binary:
    chmod 755 <filename>

    13- To see number of cards from a peer :
    cd /tmp/
    grep <peer domain> share.info | wc -l

    14- To see cards from a peer with distance and level:
    cd /tmp/
    grep <peer domain> share.info

    15- To see peer status:
    cd /tmp/
    more share.onl
    (Lines beginning with 1 are online peers, Lines beginning with 0 are offline peers)

    16- To see number of cards with level X where X = number
    cd /tmp/
    grep Lev:X share.info | wc -l

    17- To see number of cards with level X for a certain peer where X = number
    cd /tmp/
    grep <peer domain> share.info | grep Lev:X | wc -l

    18- To see number of cards at distance X where X = number
    cd /tmp/
    grep dist:X share.info | wc -l

    19- To see number of cards with distance X for a certain peer where X = number
    cd /tmp/
    grep <peer domain> share.info | grep dist:X | wc -l

    20-rebooting your server:
    reboot

    21- changing your server login password (Very important):
    passwd

    22-For editing files:
    vi <filename}
    example:
    vi /var/keys/cwshare.cfg
    Last edited by me1960; 26-05-09 at 14:15.
    Don't dream your life - live your DREAMbox ! DON'T FORGET TO SAY '' THANKS '' Note: Viewing Pay TV without a valid subscription is illegal All the files available here are kept for experimental and educational purpose only!

  4. #4
    Standard RSP member
    Join Date
    13 Feb 2007
    Location
    Earth
    Posts
    1,977
    Mentioned
    0 Post(s)
    Rep Power
    84

    Post Re: Common Unix/Linux Commands used via Telnet

    Ban cccam users in iptables


    Here is a little command to get formated iptable rules to ban deleted cccam users:

    cat /var/log/cccam.warn | awk '{printf "-A INPUT -s %s -j REJECT \n", $5}' | awk 'x[$0]++ == 0'


    the cccam.warn file is from "LOG WARNINGS" parameter in CCcam.cfg .

    in CCcam.cfg:
    LOG WARNINGS : /var/log/cccam.warn



    touch /var/log/cccam.warn
    Don't dream your life - live your DREAMbox ! DON'T FORGET TO SAY '' THANKS '' Note: Viewing Pay TV without a valid subscription is illegal All the files available here are kept for experimental and educational purpose only!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •