Skip to main content
Create interactive lessons using any digital content including wikis with our free sister product
. Get it on the
Pages and Files
1) FOLDERS IN LINUX
The root folder, where everything starts, and everything is contained in this folder (or under subfolders of this folder).
Contains system-critical programs (
Contains files needed for booting (be careful!)
Contains files which can be used to directly access your hardware (files to manipulate all your hard drives etc)(
Contains mainly configuration files for various programs/system stuff.
Contains a folder for each user (except root) where they can store their personal files.
A folder for system-critical libraries.
The home folder for root - the super-administrator (generally will be locked to normal users so you can’t take a peek).
Contains folders for the media attached to your system (CDs, DVDs and USB sticks etc)
Mounted file systems
Optional software - like desktop environments etc.
A dynamic directory - maintains information about the state of the system, including currently running processes
root users home, access not allowed to most users
Contains essential programs only designed to be run by root.
security enhanced linux
data for services provided by this system
Temporary files, deleted every restart.
Stands for Unix System Resources (not user as is commonly said). Contains lots of stuff, so I’ll look into it below.
Contains virtually every single program you use.
Contains virtually every system library that programs require to run.
Contains programs that you have manually compiled rather than installed from a package.
Contains virtually every program designed to be run by the super-administrator, root.
Houses files which power the X Window System (X version 11 release 6), which is the basis of almost every graphical environment.
Dot (that’s a full stop) means the current directory. Mainly used to start programs in the current directory (like
Two full stops means the directory one up from the current directory. So if you’re in
would take you to
The tilde symbol means your home directory - so that will be
the command line prompt
~ represents your home folder
ls lists files (black) and folders (blue)
ls -a = lists
ll files, including hidden files, which begin with a dot (.)
ls -l = l for long, lists files with details such as date, permissions, size (in bytes)
ls -lh = long and human readable, eg. size in K not bytes
ls –p distinguishes between directories (by adding / at the end of each directory) and regular files
ls –t lists contents by date of their creation, latest first
ls --help: provides detailed information about each command
pwd print working directory
file fileName: tells you what
$ ls -lh
chmod = change the mode of each file
chmod a+x trialfile; make it a shell script
chmod ug-w trialfile ;prevent writes by everyone, even you
chmod ug+x trialfile ;make it executable
chmod ug+w trialfile ;add write back in
cd = change directory
cd / or cd /. root
cd ~ or cd home folder
cd .. up one level
cd . current directory
cd - previous directory and also shows the path of where you have jumped to
cp copy specified files, eg. to copy a file from your USB to your home folder, first, navigate to your USB and then:
cp filename ~ or cp filename /home/olpc
cp file1 file2 file3 ~ = copy multiple files to your home folder
cp -r copy specified directories (folders), eg. cp -R adir /tmp will copy the directory and all its files to /tmp (r = recursive)
rm remove specified files
rm * remove all files
rm * -r remove all files and folder recursively (but still prompts for write protected files)
mv = rename or move specified files or directory, eg. mv test test1, will rename test to test1
mkdir make directory, eg. mkdir "test"
touch = updates the access and modification times of each file to the current time
eg. touch -m filename = changes only the modification time
eg. touch newfile = creates an empty new file, interesting
To run an executable from current directory
./ signifies that it should look in the current directory. It wont run by just including the filename unless the directory is in the PATH.
alsamixer access to volume controls
df -h = shows diskspace usage (FileSystem) for all partitions in MB, GB (-h option means human readable)
free -m = amount of free and used memory in the system, in MB
top = shows %CPU and %memory being used by running processes (press q to exit)
uname -a = system information, including machine name, kernel name, version
ifconfig = reports on system's network interfaces, eg. eth0, msh0
iwconfig = shows wireless network adapters
ps = shows processes running PID (process ID number)
kill = kill a process, use ps to find out the process ID and then kill PID, whatever number
lspci = lists all PCI buses and devices connected to them
lshal = lists hardware (HAL = hardware abstraction layer)
SEARCH AND EDIT
find . = lists all files in current directory and subdirectories (note the dot after find)
find . -name fav\* = lists all files in current directory and subdirectories beginning with fav
find . -iname fav\* = same as above but iname is not case sensitive, whereas name is case sensitive
The wildcard character is escaped with a slash so BASH sends a literal asterisk to the find utility as an argument instead of performing filename expansion and passing any number of files in as arguments. This 'gotcha' is important. Be aware of the characters which the shell attaches special meaning to.
find /usr -iname favoritesview.py =
search in /usr and find the path to the
s a program to search for strings inside a file
grep blah fileName = search for the text blah in the file and print any matching lines (global / regular expression / print)
grep -R "class FavoritesView" /usr/lib/python2.6/site- packages/jarabe/desktop = weird way of finding favoritesview.py?since you have to know where it is first
sed Stream EDitor, search and replace of a particular string,
eg. sed s/cat/dog/g fileName finds cat and replaces it with dog in file
cat = concatenate
cat filename = displays contents of file
cat filename | less: displays contents of file which you can navigate through | is a pipe. Press q to exit back to command prompt
cat file1 file2: adds file2 to file1
some command | less
some command | more
the difference between | more and | less is that | less allows backward movement in the file (more convenient)
nano fileName: enter a text editor
vi fileName: enter another text editor
The symbols >, < and >> are used to redirect streams of information, input and output to and from files and processes.
ls –a > foo = send list of all files in current directory to a file called foo
ls –a >> foo = appends (without overwriting) the list to an already existing file foo
USERS and ADMIN
who: tells you who is currently logged on
sudo: supervisor do?
sudo adduser $loginname
su -l (lower case L for login) "make the shell a login shell" (translation?)
su -c = pass a single command to the shell, eg. su -c 'cp file1 file2 file3 ~' (put the command in quotes)
exit: exit from bash as superuser and resume as normal user
DOWNLOAD and INSTALL
wget = GNU Wget is a simple computer program that retrieves content from web servers, and is part of the GNU Project. Its name is derived from World Wide Web and get, connotative of its primary function. It currently supports downloading via HTTP, HTTPS, and FTP protocols
tar = saves many files together into a single tape or disc archive and can restore individual files from that archive
yum = (Yellow-dog Updated, Modified), is a package-management system that simplifies the downloading, installation, and configuration of software packages
SHORTCUTS / HANDY TO KNOW
type first letter of a file name and then press tab - displays files beginning with that letter
Ctrl+C = interrupt (if stuck inside a command you don't want to go on with)
q = quit, eg. quit from help if not at the end of a file
exit = exit from bash as superuser and resume as normal user
combine options, eg. ls -lh is the quicker than ls -l -h which also works
wildcards (* all, ? single character, [ ] range)
copy and paste from and to the command line: ctrl+shift+c and ctrl+shift+v (because ctrl+c etc is reserved for interrupt)
bash = Bourne Again Shell, a command language interpreter, the most popular linux shell
shell = a program which interprets commands (interpreter)
root = top of the (upside down) tree
- arguments or options
1) Folders section: adapted from
A guide to files and folders on linux
Beginners Linux Guide
designed to help people new to the command line
help on how to format text
Turn off "Getting Started"