



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




freeworld.posterous.com
(works with about every distribution, except for apt-get which is Ubuntu/Debian exclusive)
CTRL L = Clear the terminal CTRL D = Logout SHIFT Page Up/Down = Go up/down the terminal CTRL A = Cursor to start of line CTRL E = Cursor the end of line CTRL U = Delete left of the cursor CTRL K = Delete right of the cursor CTRL W = Delete word on the left CTRL Y = Paste (after CTRL U,K or W) TAB = auto completion of file or command CTRL R = reverse search history !! = repeat last command CTRL Z = stops the current command (resume with fg in foreground or bg in background)
ls -a = list all files and folders ls
cd
du -h: Disk usage of folders, human readable du -ah: “ “ “ files & folders, Human readable du -sh: only show disc usage of folders
pwd = print working directory
man
cat
tail = from the bottom -n <#oflines>
mkdir = create new folder mkdir myStuff .. mkdir myStuff/pictures/ ..
cp image.jpg newimage.jpg = copy and rename a file cp image.jpg
mv file.txt Documents/ = move file to a folder mv
rm
touch
ln file1 file2 = physical link ln -s file1 file2 = symbolic link
date = view & modify time (on your computer)
View: date “+%H” --> If it's 9 am, then it will show 09 date “+%H:%M:%Ss” = (hours, minutes, seconds) %Y = years Modify: MMDDhhmmYYYY Month | Day | Hours | Minutes | Year
sudo date 031423421997 = March 14 th^ 1997, 23:
use 'at' to execute programs in the future
Step 1, write in the terminal: at
Step 2:
atq = show a list of jobs waiting to be executed
atrm = delete a job n°
sleep = pause between commands with ';' you can chain commands, ex: touch file; rm file you can make a pause between commands ( m inutes, h ours, d ays) ex --> touch file; sleep 10; rm file <-- 10 seconds
crontab = execute a command regularly -e = modify the crontab -l = view current crontab -r = delete you crontab In crontab the syntax is
ex, create the file movies.txt every day at 15:47: 47 15 * * * touch /home/bob/movies.txt
Add a '&' at the end of a command ex --> cp bigMovieFile.mp4 &
nohup: ignores the HUP signal when closing the console (process will still run if the terminal is closed) ex --> nohup cp bigMovieFile.mp
jobs = know what is running in the background
fg = put a background process to foreground ex: fg (process 1), f%2 (process 2) f%3, ...
w = who is logged on and what they are doing
tload = graphic representation of system load average (quit with CTRL C)
ps = Static process list -ef --> ex: ps -ef | less -ejH --> show process hierarchy -u --> process's from current user
top = Dynamic process list While in top:
CTRL C to top a current terminal process
kill = kill a process You need the PID # of the process ps -u
killall = kill multiple process's ex --> killall locate
extras: sudo halt <-- to close computer sudo reboot <-- to reboot
sudo adduser bob = root creates new user sudo passwd
addgroup friends = create a new user group delgroup friends = delete a user group
usermod -g friends
chown = change the owner of a file ex --> chown bob hello.txt chown user:bob report.txt = changes the user owning report.txt to 'user' and the group owning it to 'bob' -R = recursively affect all the sub folders ex --> chown -R bob:bob /home/Daniel
chmod = modify user access/permission – simple way u = user g = group o = other
d = directory (if element is a directory) l = link (if element is a file link) r = read (read permissions) w = write (write permissions) x = eXecute (only useful for scripts and programs)
step 4, to decompress the .tar file: tar -xvf archive.tar archive.tar
Archive and compress data the fast way:
gzip: tar -zcvf my_archive.tar.gz folder/ decompress: tar -zcvf my_archive.tar.gz Documents/
bzip2: tar -jcvf my_archive.tar.gz folder/ decompress: tar -jxvf archive.tar.bz2 Documents/
Show the content of .tar, .gz or .bz2 without decompressing it:
gzip: gzip -ztf archive.tar.gz bzip2: bzip2 -jtf archive.tar.bz tar: tar -tf archive.tar
tar extra: tar -rvf archive.tar file.txt = add a file to the .tar
You can also directly compress a single file and view the file without decompressing:
Step 1, use gzip or bzip2 to compress the file: gzip numbers.txt
Step 2, view the file without decompressing it: zcat = view the entire file in the console (same as cat) zmore = view one screen at a time the content of the file (same as more) zless = view one line of the file at a time (same as less)
When software is available in the repositories: sudo apt-get install
If you download it from the Internets in .gz format (or bz2) - “Compiling from source” Step 1, create a folder to place the file: mkdir /home/username/src <-- then cd to it
Step 2, with 'ls' verify that the file is there (if not, mv ../file.tar.gz /home/username/src/)
Step 3, decompress the file (if .zip: unzip