Post: Unix: Bash Commands
04-17-2014, 09:36 PM #1
(adsbygoogle = window.adsbygoogle || []).push({});
Quick Note: This Works for both Linux and Mac, so I felt this is the more appropriate section.


O v e r v i e w / /
Bash is a command processor that's typically run in a text window, allowing the user to type commands which cause actions. Bash can also read commands from a file, called a script. (You must login or register to view this content.)

Basically, bash is what makes the terminal you use on your Unix system tick. It processes the commands you input. It also reads commands stored in a file, called scripts.

Bash, in my opinion, is fairly intimidating at first, but becomes second nature after only a few uses.

T i p s / /
Batch can be extremely picky sometimes. It is very CASE SENSITIVE. Let us say you are looking to change the directory (CD) to your desktop.
    cd /home/Bastille/desktop

This wouldn't work however. Why? As my desktop folder is named 'Awesome faceesktop'.
    cd /home/Bastille/Desktop

Another common misconception is using an apostrophe ( ' ) when you should be using a prime ( ` ). They look a lot alike, but can cause some major headaches.

When you open up a terminal, you are automatically defaulted to the root directory. So if you would like to access a file located on your desktop, you must:
    cd /home/Bastille/Desktop

then once this step has been carried out, you are at your Desktop.

C o m m a n d s / /

There are quite a few commands for bash. Here are the most common/most useful ones. Examples are under the description.

apt-get: Used to search for and install packages (Ubuntu/Debian), requires sudo.
    sudo apt-get install example

cal: Displays a calendar
    cal

cat: Display contents of a file
    cat file.txt

cd: Change Directory. This is used to navigate around your filesystem, and could be one of the handiest commands.
    cd /home/Bastille/Desktop

clear: Clears the terminal screen of old commands. Useless except for you neat-freaks.
    clear

chmod: Change permissions of a file. This command is not to be used unless you know what you are doing. Some files/folders are locked from the user to protect them. If you were to unlock them with this and accidentally delete something from them, you could be reinstalling your OS.
    sudo chmod 777 file.txt

Note: For anymore information on Numeric Codes You must login or register to view this content.

df: Displays free space
    df

echo: Display message in terminal. Fun to talk to yourself with.
    echo hello next gen update

exit: Exit the terminal
find: Must I elaborate? Searches for files.
fsck: File System Consistency check and repair. Basically makes sure your filesystem is in tip top shape.
gawk: Find and replace text in files.
gzip: Compress files. Creates a .zip file.
    gzip file.txt

history: Display command history. Useful if you forgot a command you just entered and need it again. Note that this goes back a LONG ways, and the numbers in the picture correspond to how many commands it is.
    history

if: Conditionally perform a command. Used if you have a command that needs to be executed but aren't sure if everything is right to run the command.
    if testcommand; then secondtestcommand

ifconfig: Configure a network device (similar to ipconfig in Windoze)
    ifconfig

ifup/ifdown: Start and stop a network connection
    ifdown
ifup

install: Copy files from repository and set attributes. (Installs programs in layman's terms)
    sudo apt-get install example

killall: Stop a process.
    killall conky

ls: List files in a directory and list information about a file. Useful also for navigating the filesystem. See below.
Notice the different colors? They are different filetypes or folders located there.
make: Recompile a program. Used when a program messes up. Note that this command is used in conjunction with several others, odds are if you are going to use it you'll be reading how.
man: Help manual. Used to display the manual of CLI programs.
    man conky


THIS THREAD IS UNDER CONSTRUCTION, IT IS YET TO BE COMPLETED. THANK YOU.
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo