[vc_row][vc_column][vc_column_text]I always forget some usefull Linux command, because I’m more experienced with Windows. So I wrote them down for me.
Let’s start …[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]cat /etc/lsb-release
cat /proc/issue
uiname -a
[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Show version of linux and the distribution
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]du -csh *[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Show the sizes of all files and directories in the current directory. -c : Show a grand total -s : Show sum for every directory -h : Show results in human readable form
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815072566{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]df -a -h[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Show used disk space -a : All files -h : Human readable form
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815112542{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]lsb_release -a[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Show the installed ubuntu version
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]tar -zcvf filename.tgz sourcefolder –exclude=’folder’ –exclude=’upload/folder2′ [/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Compresses a complete folder. Exclude some folders: --exclude='foldername' Must stand before the source or the target description
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]2>/dev/null[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Ignore error output
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]sudo -i[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Open root shell
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]scp -r tux@sun.example.com:/foo_directory .[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
To copy a whole directory structure, use the recursive mode of scp.
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]groups[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
List all groups
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]groups <user>[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Show groups of a user
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]usermod -a -G <group[,group…]> <user>[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Add a user to group(s)
[/vc_column_text][/vc_column][/vc_row][vc_row css=”.vc_custom_1472815121538{margin-bottom: 10px !important;}”][vc_column][vc_separator][/vc_column][/vc_row][vc_row][vc_column width=”1/2″][vc_column_text]ls -t[/vc_column_text][/vc_column][vc_column width=”1/2″][vc_column_text]
Order ls output by date/time, most recent first, ls -tr most recent last
[/vc_column_text][/vc_column][/vc_row]