Linux: Useful cmd, tips to Get Started with Seedbox

courtesy of Pay4Pain.

Useful command, tip to get started with your seedbox or Linux in general for administrate the box for console.

NOTE
- Intend for users which is new to Linux. This hopefully makes the transit a little easier.
- I splitted the commands in section and added several words in the headlines to match different users searchpattern.
- Only for usages in the console, like remoting your seedbox.
- Be careful using rm -r! Check twice and try on a another computer in the beginning if you’re unsure.
- I tried to be as clear as possible. If it’s still not clear, feel free to contact me.
- If a command is misspelled - please contact me asap! It should though.

USEFUL TIP
- Don’t make folders as root/with sudo unless you have to.
- Linux is casesensitive which means search on xvid won’t give you anything unless you don’t specify it to be non-casesensitve
- If you need support, don’t copy, paste the errormessages / output on IRC. Use Pastebin to make everyone happy. www.pastebin.ca for example.
- Try to avoid spaces and (, ) in names. Other way backslash is necessary.
- Learn to love tab-completion!
- If the command is unknown, check if the packages is installed.
- If you’re planning to run Linux and have an old computer, install for example Ubuntu server and try these commands. Get used to it cause it is different compare to Windows.

EXAMPLE FOR APPLICATION / PACKAGES
application, packages
exp: Explanation what  the application, packages is and what it does
cmd: Example command how you see the helpfile and the manual.
Additional information (not on everyone).

RECOMMENDED APPLICATIONS / PACKAGES
Instructions for the packages in this section will be skipped, but I might add them later.

lftp
EXP: FTP-client in the console. I can give commands later.
CMD: lftp –help or… man lftp

nano
EXP: Easy and basic texteditor and not as advanced as vim.
CMD: nano –help or man nano

rsync
EXP: A very useful tool for backup, transfer etc. Secure and encrypted over SSH2.
CMD: rsync -help or man rsync
NOTE: This is tricky to get the right options. I might add my command later.

rssdler
EXP: Feeder which works as a treat together with rtorrent.
NOTE: Check the official homepage or my tutorial for RSSdler (on the forum).

rtorrent
EXP: A torrentclient using ncurse (terminal, but there are thirdpart-addons for GUI and/or webinterface).
CMD: rtorrent –help or man rtorrent
Check tutorial for install, then my tutorial for configuration.

screen
EXP: Runs a console in the background, kill X and it’s still alive.
CMD: screen –help or man screen
Check the rtorrent tutorial. Screen is included there.

vftpd
EXP: Textbased FTP-server in the console
NOTE: There will be no instructions for this. Configuration is only textbased writing an own configurationfiles.

BASIC / GENERAL / USEFUL COMMANDS
&&
Using several commands in a row if the command before works.
clear && free -m
NOTE I think you can use ; to run the command even if the command before fails.

|grep
This can filter almost anything if adding after a command.
ls|grep ScT

cd
Enter a folder.
cd sct01/

cd ..
Going back one step.

cd /
Stepping back all the way to the very first folder.

cd ~
Shortcut to homefolder.

free -m
Showing the amount of ram - note that Linux caches alot of ram.

halt -p
Shut down the computer.
There are other method, this is just one. Need root.

reboot
Restarts the computer. Need root.

ssh
Remote a computer.
ssh user@ip -p port
For example: ssh pay4pain@192.168.0.101 -p 22
Default port is 22, but if it’s change then use -p

su
Switch user, if you’re just typing su, you switch to root.
su sct

top
Taskmanager, you can use it with |grep
top|grep rtorrent

traceroute IP-adress
Showing the path to an IP-adress. Can use IP or like myshortcut.com
traceroute 192.168.0.1 or traceroute noip.com

uptime
Show your uptime, if it say like five users, then type w (I think).

BROWSING / ADMINISTRATE FOLDERS
cp
Copy a single file or several. One in this example.
cp sct01.txt /home/your_user/backup
This is when you’re in the folder which contains sct01.txt.

cp -r
Copy one folder or several. One in this example.
cp sct01/ /home/your_user/backup
This is when you’re in the folder which contains sct01.

cp -rv
Copy a folder or several and shows the output (like a confirmation it’s copied).
cp -rv sct01/ /home/your_user/backup
This is when you’re in the folder which contains sct01.

cp -rvu
Copy a folder or several, show the output and update.
cp -rvu sct* /home/your_user/backup
The folder you’re in have sct01, sct02, sct03 and in /home/your_user/backup you only have sct01 so if you use the command above sct01 won’t be copied, just sct02 and sct03.

df -h
Show you the amount of free space on harddrives.
You can use -b, -k, -m and -g too. -h means "most suitable".

du -h
Shows how big a folder is. Add a path for a certain folder or none to get the one you’re in.

ls
Showing the content of the folder you’re in.
EDIT02: Remeber dir in DOS? This is the same thing. EDIT02-end

ls -1
Showing the content of the folder you’re in, but just one folder or file/line.

ls -la
Showing hidden files and folders and who owns a/the files or folders.

mkdir
Create a folder in the foler you’re in.
mkdir sct01

mv
Moving files
mv sct01.txt /home/your_user/backup

mv
Renaming files or folders
mv sct sct.new.name

mv -r
Moving folders with content. Can be used to moves folders and files at the same time.
mv -r sct01/ /home/your_user/backup

rmdir
Remove an emtpy folder in the folder you’re in.
rmdir sct01/

rm -r
Remove a folder with subfolders and/or content
rm -r sct01

rm -rv
Remove a folder with content and showing the output / confirmation it’s removed.
rm -rv sct01

HARDWARE DIAGNOSE / ERROR CONNECTED UNITS MOUNTING UNITS
dmesg
Hardwareinformation.
May provide you with alot of information. Using |grep here is very useful.

hddtemp
Shows temp on harddrive if supported.
hddtemp /dev/hdx or hddtemp /dev/sdx
Don’t forget to change to the harddrive you want to check.

hdparm
This show you information about the harddrive/DVD-drive
hdparm -I /dev/hdx or hdparm -I /dev/sdx
NOTE: hdx/sdx should be replaced by the actual name of the unit.

lshw
Hardwareinformation.
May provide you with alot of information. Using |grep here is very useful.

lsusb
Showing whats connected to your USB-ports.

lsb_release -a
Showing the version of Linux you’re using.

mbmon
mbmon
If supported, it shows the temprature of the CPU.
NOTE: Need root if you don’t change the rights.

mount
Mounting a EXT-filesystem on Linux
mount -t ext3 /dev/hdx /mnt/hdx or mount -t ext3 /dev/sdx /mnt/sdx
Don’t forget to change to the right harddrive.

umount
Unmounting a harddrive. And yes, it’s umount.
umount /mnt/hdx or umount /mnt/sdx
Don’t forget to change to the right harddrive.

uname -r
Showing the loaded kernel.

ADMINISTRATE ACCOUNT / USERS
adduser
Add a user
adduser new_user

deluser
Remove a user
deluser new_user

passwd
Change password on a user
passwd new_user

AND I’M AWARE I SKIPPED…
Changing ownership of files and folders. - My method using -R (or if it was -r) isn’t recommened, therefore I skipped it.