Simple Shell Commands


Simple Shell commands for filesystem

    cd [-] [directory] ?Change directory
    – :Change to the previous directory you were in

    chmod [opts]?Change permissions
    -R :Change permissions recursively
    chown [-R]


    ?Change ownership
    -R :Change ownership recursively

    cp [opts] ?Copy files and directories
    -i :Interactive mode. Prompt before overwriting
    -p :Preserve file permissions and ownership
    -R :Copy directories recursively

    df [opts] [device name] ?Print filesystem usage info
    -a :Show all filesystems.
    -h :Human readable format. Quantify byte information.
    -i :Show inode usage info.

    du [opts] [pattern] ?Show space usage on files and dirs
    -c :Produce a grand total for all arguments.
    -h :Human readable format. Quantify byte information.
    -s :Summarize. Only show a total for each argument.
    -S :Do not include size of subdirectories.

    find [-name ?pattern’] ?Search for a file.
    Ex: find /home ?name ?index.html? ?perms ?644 -ls
    gzip [opts] ?Compress a file or files
    -1..9 : Set compression level. 9=highest, 1=lowest.
    -d :Decompress file. Same as the gunzip command.
    -l :List the statistics for a compressed file.

    ln [opts] ?Create a sym/hard link
    -s :Create a symbolic link between files. (alias name)
    -f :Force creation, even if the link file exists.

    ls [opts] [pattern] ?List file and directory entries
    -a :List all files including . and ..
    -d :List directories themselves, not their contents.
    -l :Long list. Shows permissions and modified time.
    -r :Recusively list files in directories.
    -S :Sort output by file size.
    -u :Sort by the last access time.
    -X :Sort by filename extension.
    -1 :Print output files one per line.
    –time=atime :Show last access timestamp for file.

    mkdir [opts] ?Make a new directory
    -m mode: Set the initial permissions to mode.
    -p :Create parent directories if they don?t exist.

    mv [-i] ?Move/Rename a file
    -i :Interactive move. Prompt before moving files.

    rm [opts] ?Remove a file
    -f :Force removal. Don?t ask if it?s ok to remove.
    -i :Interactive remove. Prompt before each file.
    -r :Recusively delete directories an their contents.

    tar [opts] [tarfile] [pattern] ?Create an archive
    c :Create mode. Create a tar archive.
    x :Extract mode. Untar archive contents.
    t :List mode. List the contents of the archive.
    f :Specify a tarfile to use.
    v :Verbose mode. Show files being added or untared.
    z :Compress. Filter input/output through gzip.

    touch [opts] ?Update the timestamp on a file
    -a :Only change the access time on the file.
    -t :Specify a timestamp to use instead of current time