0% found this document useful (0 votes)
21 views

Basic Linux

This document provides a cheat sheet for basic Linux commands and the sample directory structure of a BeagleBone system. It lists common commands like apt-get, cat, cd, chmod, cp, df, grep, ifconfig, kill, ls, mkdir, more, mv, nano, netstat, ps, pwd, rm, shutdown, ssh, sudo, tail, top, and which along with brief explanations. It also outlines the main directories in the Linux file system like bin, boot, dev, etc, home, lib, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var, and shows some of the configuration files and programs contained within

Uploaded by

doger84102
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Basic Linux

This document provides a cheat sheet for basic Linux commands and the sample directory structure of a BeagleBone system. It lists common commands like apt-get, cat, cd, chmod, cp, df, grep, ifconfig, kill, ls, mkdir, more, mv, nano, netstat, ps, pwd, rm, shutdown, ssh, sudo, tail, top, and which along with brief explanations. It also outlines the main directories in the Linux file system like bin, boot, dev, etc, home, lib, media, mnt, opt, proc, root, run, sbin, srv, sys, tmp, usr, var, and shows some of the configuration files and programs contained within

Uploaded by

doger84102
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Linux CheatSheet

1 Basic Linux commands

Most commands have many parameters. Use “commandname - -help” to see these. E.g “chmod --help”.
Note that Linux expands wildcards (‘*’) as argument for shell programs in a much better way than
Windows.
Command Comment
apt-get cmd packet Debian Packet manager – for installs. “cmd” can be e.g. “install”
cat file1 file2 Concatenate one or more files together to output stream. Used often with single file and a “pipe”.
cd path Change Directory to Path. With no path you end in your home dir (/home/kelk in my case)
chmod file Change mode of file – e.g. to make it executable. See “ls –l”
chown file Change the ownership of a file
cp path1 path2 Copy path 1 to path 2. May copy folders recursively.
date Show date and time
df Disk free. Show the disk usage. Use ‘-h’ for human readable format.
find path -name file Search for file based on name – start from path. E.g. “sudo find / -name rc.c”
grep string Look in the stream for string. E.g. “cat myfile|grep -i beagle”. Use “” if there are spaces in the string.
ifconfig Interface Config. Shows connections. “-a” also shows whats configured – but not up.
ifup interface Interface Up. Interface is eg eth0, eth1, wlan0, usb0. There is also an “ifdown”
kill -9 n Stop process number ‘n’ (use after ps –a or ps –e).
ls path List - “Dir” on linux. “–a” shows all – including those with “.” first. “-l” is long version
lsmod Show (driver-)modules
lsusb Show USB devices. As in many other cases “-v” is verbose (detailed).
mkdir path Make Directory
man cmd Manual. Extensive description of any command.
more file Show the file a page at a time. Same as cat file|more.
mv path1 path2 Moves path1 to path2 name
nano path Basic text editor. Installed from start, works over a text ssh.
netstat Show network processes (as on windows)
nmap Network Scanner
ps Show processes. Typical options are ‘-e’ or ‘-a’
pwd Print Working Directory
rm path Removes a path. Take care when using “-r” (recursive)!
rmdir path Delete Directory
shutdown Typically “sudo shutdown –h now” – for halt now.
source file Run a script or binary file in current directory. Similar to ./file
ssh user@address Secure Shell. Modern “telnet”. Address can be an IP-address.’-X’ for graphics. VNC is an alternative.
sudo cmd Run cmd as superuser. You will be asked for password. sudo!! → latest sudo repeated
tail –n file Show the last n lines of a file. ‘-f’ will do this continuously, if the file is updated from another
process
tmux Terminal Multiplexer – have several open terminals in one window
top List the top CPU-demanding processes – ongoing updates. Use CTRL-C to stop.
tree Show semi-graphical view of directory structure (need to “apt-get install tree” first)
which cmd Tells where on the path the given cmd is found
whoami What is my current login name
Shell Tricks Comment
cmd-a | cmd-b “Pipe” output from cmd-a into cmd-b as input. E.g. “netstat –an|grep 5900” shows use of port
5900.
cmd & Run in parallel in the background. Use “;” to run commands sequentially
cmd-a > dest Output from cmd-a is input to dest (file or new cmd). “>>” appends. “>2” is errorout
CTRL-C Stop foreground execution
CTRL-Z Pause foreground execution. Type “bg” to continue in background
./file Run a script/program in the current dir. Avoids mistakes due to spelling errors!
TAB Commandline Completion. Use twice to see list of choices left.

Kelk 1I3
Linux CheatSheet

2 Sample Directory Structure (BeagleBone)

/ | |-- initramfs-tools
|-- bin Binary low-level stuff - system & user | |-- insserv
|-- boot Home of zImage (kernel) and config files | |-- insserv.conf.d
| `-- uboot uEnv.txt with kernel commandline. BBB HW | |-- iproute2
Docs | |-- javascript-common
|-- dev Special Device files | |-- kbd
| |-- block Block based. Links to RAM etc | |-- kernel
| |-- bus Bus devices - USB is here | |-- ld.so.conf.d
| |-- char Character-based. Links to TTY | |-- ldap Lightweight Directory Access
| |-- disk Links to disks by id, path etc | |-- libnl-3
| |-- dri | |-- lightdm
| |-- fd -> /proc/self/fd | |-- logcheck
| |-- input | |-- logrotate.d
| |-- mapper | |-- menu-methods
| |-- mqueue Message Queue (empty) | |-- modprobe.d Drivers – e.g Alsa sound conf
| |-- net | |-- modules-load.d
| |-- pts | |-- network
| |-- shm | |-- openal
| `-- snd Sound | |-- opt
|-- etc System related configuration! | |-- pam.d
| |-- ConsoleKit | |-- pcmcia
| |-- UPower | |-- perl
| |-- Wireless Default WiFi Configuration | |-- php5 PHP – mainly used in Webserver
| |-- X11 Graphical User Interface | |-- pkcs11
| |-- acpi Power-savings etc. | |-- pm
| |-- alternatives | |-- polkit-1
| |-- apache2 Apache Web-server | |-- ppp
| |-- apm | |-- profile.d
| |-- apparmor.d | |-- pulse
| |-- apt Packet Manager | |-- python
| |-- avahi Bonjour | |-- python2.6
| |-- bash_completion.d | |-- python2.7
| |-- binfmt.d | |-- rc0.d Runlevel 0 (halt) – links to /etc/init.d
| |-- ca-certificates | |-- rc1.d Runlevel 1 (single-user) – links …
| |-- calendar | |-- rc2.d Runlevel 2 (multi-user)
| |-- chatscripts | |-- rc3.d Runlevel 3 (multi-user with network)
| |-- chromium | |-- rc4.d Runlevel 4 (user-defined)
| |-- console-setup | |-- rc5.d Runlevel 5 (Normal)
| |-- cron.d Scheduler Daemon | |-- rc6.d Runlevel 6 (Restart)
| |-- cron.daily | |-- rcS.d
| |-- cron.hourly | |-- resolvconf
| |-- cron.monthly | |-- rsyslog.d
| |-- cron.weekly | |-- sane.d
| |-- dbus-1 | |-- security
| |-- default | |-- selinux
| |-- dhcp DHCP client config | |-- sgml
| |-- dictionaries-common | |-- skel
| |-- dpkg Base of Debian Packet Manager | |-- ssh Secure Shell - Keys
| |-- emacs Emacs Editor | |-- ssl Secure Sockets Layer – Certificates etc.
| |-- fonts | |-- sudoers.d Not really used
| |-- fstab.d | |-- sysctl.d
| |-- gconf | |-- systemd 1’st Process. System and User Conf.
| |-- gdb Gnu Debugger | |-- terminfo
| |-- groff Text Formatter. Low-level Word. | |-- timidity
| |-- gtk-2.0 | |-- tmpfiles.d
| |-- gtk-3.0 | |-- udev
| |-- hostapd Network config | |-- ufw
| |-- ifplugd | |-- usb_modeswitch.d
| |-- init Configuration Files for init | |-- vim
| |-- init.d Scripts/programs executed by the init daemon
| |-- wicd | |-- dbus
| |-- wildmidi | |-- initramfs
| |-- wpa_supplicant | |-- lightdm
| |-- xdg | |-- lock

Kelk 2I3
Linux CheatSheet

| |-- xml | |-- log


| `-- xrdp | |-- mount
|-- home Users home directories | |-- network
| |-- debian | |-- pm-utils
| `-- kelk Users home-dir (here kelk) | |-- screen
|-- lib Libraries | |-- sendsigs.omit.d
| |-- arm-linux-gnueabi Software Floating Point Library | |-- sshd SSH Daemon
| |-- arm-linux-gnueabihf Hardware Floating Point Library | |-- systemd 1’st process. Entries by sysadm
| |-- firmware BB Overlays defining P8 & P9 etc. | |-- udev
| |-- hdparm | |-- udisks
| |-- init | |-- user
| |-- lsb | |-- wicd
| |-- modprobe.d Daemon for Loadable Kernel Modules | |-- wpa_supplicant
| |-- modules Drivers | `-- xrdp
| |-- security |-- sbin Binary files for the system only
| |-- systemd 1’st process. Executables. Entries by distro |-- selinux Empty
| |-- terminfo |-- srv Empty
| |-- udev |-- sys
| `-- xtables | |-- block MMC and RAM
|-- lost+found file-pieces from e.g. untimely powerdowns! | |-- bus IIC, SCSI, USB etc.
|-- media Removable Media Mount | |-- class Device classes (types)
|-- mnt Mount file-systems here | |-- dev Links toactual devices
|-- opt Software non-default installation | |-- devices BBB HW PinMUX, cape-definitions etc
| |-- cloud9 Port 80 web-server with BBB default | |-- firmware Empty
| |-- scripts | |-- fs File Systems
| `-- source | |-- kernel
|-- proc Process info pseudo-file system | |-- module Loadable Drivers and their parameters
| |-- 1 | `-- power
| |-- 10 |-- tmp Temporary Files – May be deleted
| |-- 1012 | `-- ssh-iRhRkBa8DnRG
......... "files" for processes – cut out |-- usr User usable programs and data
| |-- 949 | |-- bin Most utility programs. Many as links
| |-- asound | |-- games
| |-- bus | |-- include Include-files for C/C++ programs
| |-- cpu | |-- lib Libraries for C/C++-programs
| |-- device-tree | |-- local Programs for all users (not part of distro)
| |-- dri | |-- sbin
| |-- driver | |-- share
| |-- fs | `-- src
| |-- irq `-- var Variable data - logs, spooler etc
| |-- net -> self/net |-- backups Apt, passwords
| |-- scsi |-- cache Apache2, git, man etc.
| |-- self -> 1676 |-- lib Empty
| |-- sys System Info. Edit’s do not survive a boot |-- local Empty
| |-- sysvipc |-- lock -> /run/lock
| `-- tty |-- log Log-files – e.g. dmesg from boot
|-- root Empty root folder |-- mail Empty (Mails)
|-- run Program runtime storage – not to delete |-- opt Empty
| |-- ConsoleKit |-- run -> /run PID’s of services
| |-- apache2 |-- spool Printer spooler
| |-- avahi-daemon |-- tmp Empty
| |-- console `-- www Web-pages (Apache)
Generated with: “sudo tree -d -L 2 /” Arrows are links.

Note that /boot/uboot is the folder that is shared with a windows PC connected via the USB. Take care here.

Sample: /usr/local/share/emacs
Interpret: |----Scope---|Category|Application

Kelk 3I3

You might also like