this post was submitted on 28 May 2024
14 points (88.9% liked)

Linux

48193 readers
1707 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

upgrading xubuntu to 24.04, fresh install, but I'd like to copy the output of both dpkg -l and history to a usb stick.

About history: will it copy all commands I executed on all tabs? I work with several tabs simultaneously.

ETA: thank you for all your input, problem has been solved.

you are viewing a single comment's thread
view the rest of the comments
[–] bloodfart@lemmy.ml 4 points 5 months ago* (last edited 5 months ago) (1 children)

plug in the usb, run the command lsblk. it will list all the block devices that the computer can see.

look for your usb by size, etc. the column "name" after lsblk will be the device and partition (for example sdc and sdc1). the "name" entry on the same line as your usb's size with a number after it is the partition, the one without a number is the usb itself. you will be mounting the partition.

make a directory in /var to mount the usb stick in with mkdir /var/usb. that command writes to the /var section of your filesystem, where /var-iable files live. mount the usb stick at that location with mount /dev/[your partition, like sdc1] /var/usb.

example: my usb was /dev/sdc1, so for me it's mount /dev/sdc1 /var/usb. the syntax is mount [device] [location].

run any command with |tee -i /var/usb/target_filename.txt after it to both output the command to the screen and send it to a file on the usb. that command writes the output of whatever command preceeds it to the specified file in /var/usb.

example: ls / |tee -i /var/usb/target_filename.txt would write the output of the command "ls /", listing the contents of the root of your filesystem, to /var/usb/target_filename.txt as well as displaying it. if /ver/usb/target_filesystem.txt doesn't exist, it will be created.

use different files on different commands so you don't write over what you have or pass -a to the tee command so it will -a-ppend the text it writes to the end of the file. ex: |tee -ia /var/usb/filename.txt

for the specific command you asked about, it would be dpkg -l |tee -i /var/usb/target_filename

to write out your command history, use the "history" command. it can be given the tee treatment as well. to access a users history look at their $HISTFILE. if you don't know what interpreter they're using, assume bash and look for ~/.bash_history

[–] merompetehla@lemmy.ml 1 points 5 months ago (1 children)
[–] bloodfart@lemmy.ml 1 points 5 months ago (1 children)

Did you get it straightened out?